Array instead of the variable name.
On Jan 21, 2005, at 3:14 PM, Hutchins, Richard wrote:
Probably all you need to do is name your checkboxes as an array thusly:
name="completed[]"
Then you can access the array on your update page and do whatever you wish
with it.
Hope this helps.
Rich
-----Original Message----- From: Craig Hoffman [mailto:choffman@xxxxxxxxxx] Sent: Friday, January 21, 2005 4:03 PM To: php-db@xxxxxxxxxxxxx Subject: checkboxes
I have a form that display's a checkbox if the value is NULL. The form is in a do... while loop, so the user may check multiple checkboxes. I am trying to pass the variable of each checkboxes to an update statement in MySQL. THe problem is I am only getting one of the checkboxes, even if all of them are checked. Here is my code block, any help would be great. - Craig
//From form page <form> <input type='checkbox' name='completed' value='Done' > </form>
//MySQL Update Page $email = $_POST['email'] == $route; $completed = $_POST["completed"] == $route; $route_name = trim($_POST["route_name"]) == $route; $user_id = $_POST['user_id'] == $route; $id = $_POST['id'] == $route;
$route = array(id => "$_POST[id]", completed => "$_POST[completed]", route_name => "$_POST[route_name]", user_id => "$_POST[user_id]");
foreach ($route as $key => $values) { echo("<br />"); echo $values; //MySQL Update statement will go here. }
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php