note 37887 added to language.variables.external
| From: | darrenatsullivandotnet at rn2 dot php dot net | Date: | Mon, 01 Dec 2003 13:37:18 +0000 |
| Subject: | note 37887 added to language.variables.external | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-61204@lists.php.net to get a copy of this message | ||
This function is a simple solution for getting the array of selectes from a checkbox list or a
dropdown list out of the Querry String. I took an example posted earlier and simplified it.
function multi_post_item($repeatedString) {
// Gets the specified array of multiple selects and/or
// checkboxes from the Query String
$ArrayOfItems = array();
$raw_input_items = split("&", $_SERVER["QUERY_STRING"]);
foreach ($raw_input_items as $input_item) {
$itemPair = split("=", $input_item);
if ($itemPair[0] == $repeatedString) {
$ArrayOfItems[] = $itemPair[1];
}
}
return $ArrayOfItems;
}
Use the name of the field as the agrument. Example:
$Order = $_GET['Order'];
$Name = $_GET['Name'];
$States = multi_post_item('States');
$Products = multi_post_item('Products');
Be sure to check for NULL if there are no selections or boxes checked.
----
Manual Page -- http://www.php.net/manual/en/language.variables.external.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+37887
Delete -- http://master.php.net/manage/user-notes.php?action=delete+37887&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+37887&report=yes
Search -- http://master.php.net/manage/user-notes.php