note 33845 added to language.variables.external
| From: | cscotti at ifrance dot php dot net | Date: | Wed, 09 Jul 2003 09:53:06 +0000 |
| Subject: | note 33845 added to language.variables.external | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-51762@lists.php.net to get a copy of this message | ||
In reply to the second post:
This function construct an HTTP vars array
It is useful for javascript/dom incompatibility with form_input_item[] names for checkboxes,
multiple selects, etc.
function multi_post_item() {
$array_output = array();
$raw_input_items = split("&", $_SERVER["QUERY_STRING"]);
foreach ($raw_input_items as $input_item) {
// split this item into name/value pair
$item = split("=", $input_item);
// form item name
$item_name = urldecode($item[0]);
// form item value
$item_value = urldecode($item[1]);
if (!isset($array_output[$item_name]) ) {
$array_output[$item_name] = $item_value;
}else if (!is_array($array_output[$item_name])){
$first = $item_value;
$array_output[$item_name] = array();
$array_output[$item_name][]= $first;
$array_output[$item_name][]= $item_value;
}else{
$array_output[$item_name][]= $item_value;
}
}
return $array_output;
}
----
Manual Page -- http://www.php.net/manual/en/language.variables.external.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+33845
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+33845&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+33845&report=yes