RE: [PHP-DB] html check boxes to mySQL

From: Date: Thu, 01 Jun 2000 13:37:59 +0000
Subject: RE: [PHP-DB] html check boxes to mySQL
Groups: php.db 
Request: Send a blank email to php-db+get-151@lists.php.net to get a copy of this message
Hello, When you tick a check box then submit a variable entitled NAME set to VALUE is created. e.g. <INPUT TYPE="CHECKBOX" NAME="TICK_ME" VALUE="TICKED"> After submission if the checkbox is ticked then $TICK_ME exists (="TICKED") if not ticked then $TICK_ME won't exist. You probably need to select a number of records by ticking checkboxes, e.g. <FORM ...> <INPUT TYPE="CHECKBOX" NAME="DELETE_ME[]" VALUE="000001"> <INPUT TYPE="CHECKBOX" NAME="DELETE_ME[]" VALUE="000002"> <INPUT TYPE="CHECKBOX" NAME="DELETE_ME[]" VALUE="000003"> <INPUT TYPE="CHECKBOX" NAME="DELETE_ME[]" VALUE="000004"> <INPUT TYPE="CHECKBOX" NAME="DELETE_ME[]" VALUE="000005"> <!-- extra two so always results in an array for code below, or instead use is_array in php below <INPUT TYPE="HIDDEN" NAME="DELETE_ME[]" VALUE="VOID"> <INPUT TYPE="HIDDEN" NAME="DELETE_ME[]" VALUE="VOID"> </FORM> Here, once the form is submitted. an array entitled $DELETE_ME[] exists with one entry for each ticked checkbox. so, reset($DELETE_ME); while(list($k,$v)=each($DELETE_ME)) { if ($v!="VOID") { run sql to delete record $v } } Hope this helps -Stewart -----Original Message----- From: Kenn Murrah [mailto:warden@bakergrfx.com] Sent: 01 June 2000 14:16 To: php-db@lists.php.net Subject: [PHP-DB] html check boxes to mySQL Greetings. Can anyone point me to sample code for capturing HTML check boxes or radio buttons to a mySQL database? Thanks in advance, Kenn -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net For additional commands, e-mail: php-db-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.db (#151) next »