dudejma Posted January 15, 2012 Share Posted January 15, 2012 I have this form. The name of the field is an id of a row in a table. When the user inputs the information into the field, it goes to another page that processes the information. This is the code on the page that processes it: while ($ids = mysql_fetch_array($getIDs) { $staffID = $ids['id']; //id is the column name in my table $value = $_POST['$staffID']; But when I echo $value, it doesn't echo anything. I have made sure that there is a value in the field and if, instead of $_POST['$staffID'], I type a specific ID such as, $_POST['55485'], it will output the value entered in that field. I have not yet grasped the concept of arrays yet so that's why I'm not using one here. Can you just not put a variable in $_POST? Thanks. Quote Link to comment Share on other sites More sharing options...
litebearer Posted January 15, 2012 Share Posted January 15, 2012 $_POST is an array used to gather field data from a FORM; each element of the array uses the form field name. what your code does is try to use an element that does not exist. make sense? Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted January 15, 2012 Share Posted January 15, 2012 You're probably going to need to post the form as well as the code that puts the IDs into it. Quote Link to comment Share on other sites More sharing options...
dudejma Posted January 15, 2012 Author Share Posted January 15, 2012 <form action="takeAttendance1.php" method="post"> <table> <tr> <th>Name</th> <th>Mark</th> </tr> <tr> <?php echo '<td>' . $row['lastName'] . ', ' . $row['firstName'] . '</td>'; echo '<td><input type="text" name="' . $row['id'] . '"></td>'; ?> </tr> </table> <input type="submit" value="Enter Attendance"> </form> Quote Link to comment Share on other sites More sharing options...
litebearer Posted January 15, 2012 Share Posted January 15, 2012 Your post array will contain the following... $_POST['firstName']; $_POST['lastName']; $_POST['id']; I suspect we might also need to see more of your processing script Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.