9.16.1. ProblemYou want to process a variable with a period in its name, but when a form is submitted, you can't find the variable in $_GET or $_POST. 9.16.2. SolutionReplace the period in the variable's name with an underscore. For example, if you have a form input element named hot.dog, you access it inside PHP as the variable $_GET['hot_dog'] or $_POST['hot_dog']. 9.16.3. DiscussionDuring PHP's pimply adolescence when register_globals was on by default, a form variable named hot.dog couldn't become $hot.dog'periods aren't allowed in variable names. To work around that, the . was changed to _. While $_GET['hot.dog'] and $_POST['hot.dog'] don't have this problem, the translation still happens for legacy and consistency reasons, no matter your register_globals setting. You usually run into this translation when there's an element of type image in a form that's used to submit the form. For example, a form element such as <input type="image" name="locations" src="/books/3/131/1/html/2/locations.gif">, when clicked, submits the form. The x and y coordinates of the click are submitted as locations.x and locations.y. So in PHP, to find where a user clicked, you need to check $_POST['locations_x'] and $_POST['locations_y']. 9.16.4. See AlsoDocumentation on variables from outside PHP at http://www.php.net/language.variables.external. |