note 30866 added to language.variables.external

From: Date: Tue, 01 Apr 2003 16:07:58 +0000
Subject: note 30866 added to language.variables.external
Groups: php.notes 
Request: Send a blank email to php-notes+get-46085@lists.php.net to get a copy of this message
This function takes a recurring form item from php://input and loads it into an array - useful for javascript/dom incompatibility with form_input_item[] names for checkboxes, multiple selects, etc. The fread maxes out at 100k on this one. I guess a more portable option would be pulling in ini_get('post_max_size') and converting it to an integer. function multi_post_item($input_item_name) { $array_output = array(); $in_handle = fopen("php://input", "r"); $raw_input_items = split("&", urldecode(fread($in_handle, 100000))); foreach ($raw_input_items as $input_item) { // split this item into name/value pair $item = split("=", $input_item); // form item name $item_name = $item[0]; // form item value $item_value = $item[1]; if ($item_name == $input_item_name) { $array_output[] = $item_value; } } return $array_output; } -- http://www.php.net/manual/en/language.variables.external.php http://master.php.net/manage/user-notes.php?action=edit+30866 http://master.php.net/manage/user-notes.php?action=delete+30866 http://master.php.net/manage/user-notes.php?action=reject+30866

« previous php.notes (#46085) next »