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 13

This 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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to