note 72572 added to reserved.variables

From: Date: Wed, 24 Jan 2007 19:53:18 +0000
Subject: note 72572 added to reserved.variables
Groups: php.notes 
Request: Send a blank email to php-notes+get-122158@lists.php.net to get a copy of this message
I think it is very important to note that PHP will automatically replace dots ('.') AND spaces (' ') with underscores ('_') in any incoming POST or GET (or REQUEST) variables. This page notes the dot replacement, but not the space replacement: http://us2.php.net/manual/en/language.variables.external.php The reason is that '.' and ' ' are not valid characters to use in a variable name. This is confusing to many people, because most people use the format $_POST['name'] to access these values. In this case, the name is not used as a variable name but as an array index, in which those characters are valid. However, if the register_globals directive is set, these names must be used as variable names. As of now, PHP converts the names for these variables before inserting them into the external variable arrays, unfortunately - rather than leaving them as they are for the arrays and changing the names only for the variables set by register_globals. If you want to use: <input name="title for page3.php" type="text"> The value you will get in your POST array, for isntance would be: $_POST['title_for_page3_php'] ---- Server IP: 216.194.113.175 Probable Submitter: 65.102.107.60 ---- Manual Page -- http://www.php.net/manual/en/reserved.variables.php Edit -- https://master.php.net/note/edit/72572 Del: integrated -- https://master.php.net/note/delete/72572/integrated Del: useless -- https://master.php.net/note/delete/72572/useless Del: bad code -- https://master.php.net/note/delete/72572/bad+code Del: spam -- https://master.php.net/note/delete/72572/spam Del: non-english -- https://master.php.net/note/delete/72572/non-english Del: in docs -- https://master.php.net/note/delete/72572/in+docs Del: other reasons-- https://master.php.net/note/delete/72572 Reject -- https://master.php.net/note/reject/72572 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#122158) next »