note 56696 added to tutorial.forms

From: Date: Mon, 12 Sep 2005 19:36:24 +0000
Subject: note 56696 added to tutorial.forms
Groups: php.notes 
Request: Send a blank email to php-notes+get-95068@lists.php.net to get a copy of this message
This was mentioned, but not really explained, and way too useful to overlook.. $_REQUEST no matter what method you used to get the variables to your page, GET, POST, or even from a cookie; that variable will be available in the $_REQUEST array. So in our form.. <form action="action.php" method="post"> <p>Your name: <input type="text" name="name" /></p> ... $_POST['name']; equals 'Joe', or whatever they entered. But so does $_REQUEST['name']. It contains exactly the same value. In effect, $_REQUEST acts as a catch-all for all the http arrays. I haven't tested what happens if a cookie and a POST variable share the same name, but if I was going to, I'd definitely use something like.. http://corz.org/beta?download=debug-unit.zip forgive the plug, but if you're starting out with php and forms, you *need* something like this. have fun! ;o) (or ---- Manual Page -- http://www.php.net/manual/en/tutorial.forms.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+56696 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+56696&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+56696&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+56696&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+56696&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+56696&report=yes&reason=non-english Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+56696&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+56696&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#95068) next »