Jump to content

Insert Data


dudejma

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/255095-insert-data/
Share on other sites

<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>

Link to comment
https://forums.phpfreaks.com/topic/255095-insert-data/#findComment-1307985
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.