note 40039 added to language.variables.external
| From: | jan dot gaciochatmotoroladotcom at rn2 dot php dot net | Date: | Thu, 19 Feb 2004 16:52:31 +0000 |
| Subject: | note 40039 added to language.variables.external | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-65408@lists.php.net to get a copy of this message | ||
Just a correction regarding 'cscotti@ifrance' contribution: code '$first =
$item_value;' should be place just BEFORE the 'else if' condition and NOT AFTER.
So correct code would be:
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;
$first = $item_value;
} elseif ( !is_array($array_output[$item_name]) ) {
$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 -- http://master.php.net/manage/user-notes.php?action=edit+40039
Delete -- http://master.php.net/manage/user-notes.php?action=delete+40039&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+40039&report=yes
Search -- http://master.php.net/manage/user-notes.php