note 79681 added to reserved.variables

From: Date: Fri, 07 Dec 2007 19:50:05 +0000
Subject: note 79681 added to reserved.variables
Groups: php.notes 
Request: Send a blank email to php-notes+get-132939@lists.php.net to get a copy of this message
$_POST[...] does not support dots or spaces in the HTML form element names; replacing them with underscores. Strictly speaking spaces break W3 but not dots. Therefore I have written this workaround. It uses the $GLOBALS['HTTP_RAW_POST_DATA'] variable and converts it using urldecode(...). The function outputs an associative array that unlike $_POST can handle dots and spaces. You will need to set always_populate_raw_post_data to on in your php.ini file. <?php function get_posted_data_from_raw(){ //For this to work the always_populate_raw_post_data configuration directive in php.ini need to be on if(isset($GLOBALS['HTTP_RAW_POST_DATA'])){ $temparr1 = split('&',$GLOBALS['HTTP_RAW_POST_DATA']); foreach($temparr1 as $tempstr1){ $temparr2 = split('=',$tempstr1); $post[urldecode($temparr2[0])] = urldecode($temparr2[1]); } return $post; } } ?> Martin ---- Server IP: 87.124.64.96 Probable Submitter: 87.194.16.144 ---- Manual Page -- http://www.php.net/manual/en/reserved.variables.php Edit -- https://master.php.net/note/edit/79681 Del: integrated -- https://master.php.net/note/delete/79681/integrated Del: useless -- https://master.php.net/note/delete/79681/useless Del: bad code -- https://master.php.net/note/delete/79681/bad+code Del: spam -- https://master.php.net/note/delete/79681/spam Del: non-english -- https://master.php.net/note/delete/79681/non-english Del: in docs -- https://master.php.net/note/delete/79681/in+docs Del: other reasons-- https://master.php.net/note/delete/79681 Reject -- https://master.php.net/note/reject/79681 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#132939) next »