note 79681 deleted from reserved.variables by felipe

From: Date: Sun, 30 Dec 2007 18:28:54 +0000
Subject: note 79681 deleted from reserved.variables by felipe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-134375@lists.php.net to get a copy of this message
Note Submitter: email at martinclewett dot com ---- $_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

« previous php.notes (#134375) next »