Hello again my friends. Got something I've been working on all day and I finally gave in and decided to post. I have the row below that is a repeating row grabbing the values from an employee table. The company wants to add the ability to change the projectAccess of multiple employees from this page that used to just show all the info and then you could click the edit button to change the info. I have added a radio button that reflects the proper access yes or no being selected depending on the employee's access status, but I'm stuck as to how to update them all at once. I assume I just put a <form action="update-access.php" method="post"></form> tag around the whole table with a update button.
echo "<tr $color><td>$idnum</td><td>$prid</td>"
."<td>$lname</td><td>$fname</td><td>$type</td>"
."<td>$salary</td><td>$location</td><td>$supervisor_fullname</td><td>";
if ($projectAccess == 'Yes') {
print "<INPUT type=\"radio\" name=\"projectAccess".$idnum."\" value=\"Yes\" CHECKED > Yes <INPUT type=\"radio\" name=\"projectAccess".$idnum."\" value=\"No\" > No";
}else{
print "<INPUT type=\"radio\" name=\"projectAccess".$idnum."\" value=\"Yes\" > Yes <INPUT type=\"radio\" name=\"projectAccess".$idnum."\" value=\"No\" CHECKED > No";
}
print "</td>";
print "<td><a href=edit-user/?id=$idnum><img src=note.gif alt=edit ";
print "border=0></a></td></tr>\n";
}
}
print "</table>\n";
In the update-access.php script I have the following just to test my connection. How do I get the value of each employee to this script and update each records? I'm sure it has something to do with arrays but to put it bluntly I suck at arrays...haha
// Connect to MySQL
$result = mysql_query("UPDATE employees SET projectAccess='value of radio button' WHERE idnum='id number of employee'")
or die(mysql_error());
Any help would be much appreciated. Thanks in advance,
Eric