note 69741 added to reserved.variables

From: Date: Tue, 19 Sep 2006 09:16:15 +0000
Subject: note 69741 added to reserved.variables
Groups: php.notes 
Request: Send a blank email to php-notes+get-117305@lists.php.net to get a copy of this message
If you want to use a form with multiple checkboxes (e.g. one per row) and assign the same name to each checkbox then the name needs to end with []. This tells PHP to put all checked values into an array variable. For example: <input type="checkbox" name="id[]" value="value_1"> <input type="checkbox" name="id[]" value="value_2"> .. <input type="checkbox" name="id[]" value="value_x"> You can now retrieve all values by using: $values = $_POST['id']; If the name does not end with [], then only a single value will be available via the $_POST variable even if the user checks several checkboxes. ---- Server IP: 217.13.201.10 Probable Submitter: 84.56.109.124 ---- Manual Page -- http://www.php.net/manual/en/reserved.variables.php Edit -- https://master.php.net/note/edit/69741 Del: integrated -- https://master.php.net/note/delete/69741/integrated Del: useless -- https://master.php.net/note/delete/69741/useless Del: bad code -- https://master.php.net/note/delete/69741/bad+code Del: spam -- https://master.php.net/note/delete/69741/spam Del: non-english -- https://master.php.net/note/delete/69741/non-english Del: in docs -- https://master.php.net/note/delete/69741/in+docs Del: other reasons-- https://master.php.net/note/delete/69741 Reject -- https://master.php.net/note/reject/69741 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#117305) next »