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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.