Checking radio buttons for multiple records/Updating multiple records...

From: Date: Sun, 29 Jul 2001 03:35:51 +0000
Subject: Checking radio buttons for multiple records/Updating multiple records...
Groups: php.db 
Request: Send a blank email to php-db+get-10871@lists.php.net to get a copy of this message
Ok, here is what I am trying to do. I know that it is very common. Simplified: I have a tabble of users with an AUTHORIZE field [type ENUM - Yes or No]. They sign up and once I authorize them. I pull up all of the records and display them something like this: User Name - Authorize: [] Yes [] No So i run my select thru a while loop and end up with User Name - Authorize: [] Yes [] No User2 Name - Authorize: [] Yes [] No User3 Name - Authorize: [] Yes [] No User4 Name - Authorize: [] Yes [] No The settings already in the database should show. So that either Yes or No is checked for each user. so here is the code I use: if ($authorize == "Y") { $chk_authorize = "Authorized: <input type=\"radio\" name=\"authorize\" value=\"Y\" checked>Yes <input type=\"radio\" name=\"authorize\" value=\"N\">No"; } else { $chk_authorize = "Authorized: <input type=\"radio\" name=\"authorize\" value=\"Y\">Yes <input type=\"radio\" name=\"authorize\" value=\"N\" checked>No"; } This works EXCEPT only the last field displays a checked radio button [because the names are all the same. How can do this so that each record displays current authorization setting? After this I need to be able to SUBMIT the info to UPDATE the table. I understand that I will have to execute a number of update statements ... But how can I create these statements that tie the correct username and AUTHORIZE value together? thanks much, olinux _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com

« previous php.db (#10871) next »