Hi, I need help
I have a form with an input field addEdit, after pressing a submit button I need to read the value from addEdit and sent it to db. The problem is no value is sent through $_POST . Why ?

<form name='frm' method='POST' action=''>
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr class="heading">
<td style="width:5px;"><input type="checkbox" name='check_all' onClick='checkAll();' /></td>
<td class="head">App Name</td>
.
.
<?php
//some embeded php (here is the addEdit component)
.
.
echo '
<td id="row_'.$row['id'].'" style="display: none;">
 <input type="text" name="addEdit" id="addEdit_row_'.$row['id'].'" value="" size="4"/></td>
<td>
        <input type="submit" name="add" value="A"  onClick="addObs('.$row['id'].'); return false;"/>
';
</td>
.
.//end oh php code
?>
<!-- end of html code -->

as you saw, the addEdit component is embeded in php code

if(isset($_POST['add']))
{
 //echo 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa';
 if (isset($_POST['addEdit']))
 {
  echo 'post: '.$_POST['addEdit'];
 }
}

Recommended Answers

All 4 Replies

where is your ending tag of form? </form>

the /form tag is somewhere after the ?> tag

SOLVED, the problem was that the Add submit button (that I was using to read data from AddEdit input box) is not the main submit button of my form frm.
I`ve just created a nested form containing the input box AddEdit and the button Add. Thank you all for willing to help.

POST returns the name variable,as a name=> value pair, not the id.
The syntax might be something like:

cho '
<td id="row_'.$row['id'].'" style="display: none;">
 <input type="text" name="addEdit[$id]" id="addEdit_row  value="" size="4"/></td>

This may not be compatable with what you are doing, but you get the idea...
$_post will return an array of addEdit

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.