Re: $_Request from 4.3 to v5.x
| From: | John W. Holmes | Date: | Tue, 13 Jul 2004 14:51:30 +0000 |
| Subject: | Re: $_Request from 4.3 to v5.x | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-190356@lists.php.net to get a copy of this message | ||
Michael Purdy wrote:
I have a script which accepts three POSTed variables from a basic form. Under 4.3.7 the script runs fine and the variables are successfully passed to the script. I am testing 5.0 C3 and receive the following error PHP Notice: Undefined index: searchtype in c:\http\cgi\list7.php on line 13 <script language='php'> $searchtype = $_REQUEST['searchtype']; -- this is line 13This is simply a notice saying that there was no variable named 'searchtype' passed from your form data. More than likely searchtype is a checkbox. When checkboxes are not checked, they are not sent with the form data, so there simply IS NO $_REQUEST['searchtype'] variable. It is not set. You should be checking for this using isset(). $searchtype = isset($_REQUEST['searchtype']) ? $_REQUEST['searchtype'] : 'default value'; You will want to check the other values, too. Just because your form has three elements in it, that doesn't mean every request coming to your processing script will have the same three elements... -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals – www.phparch.com