Re: Post form values - script flow

From: Date: Tue, 21 May 2002 17:42:20 +0000
Subject: Re: Post form values - script flow
Groups: php.general 
Request: Send a blank email to php-general+get-98617@lists.php.net to get a copy of this message
Looks good Tim. if you're going to do it this way, make sure register_globals is set on in your php.ini. also you check isset($srch) AND strlen(trim($srch)). in most cases, both checks won't be necessary. unless you have high error reporting, and php will complain if you check a variable that hasn't been set yet. jerome ----Original Message Follows---- From: "Tim Greenleaf" <tim_greenleaf@yahoo.com> I am very new to PHP about two hours. I have a search page that I post back to the same URL. When the form is loaded I check to see if the seach variable is set ($srch is the name of the text box on the form) and then determine what function to call. I either call a welcome message function to be printed to the page or a function to search a database and build a table of results. I have included my script below....My question is: Is this a good way to handle search forms with PHP? Since I have no examples to work from I am not sure what the proper way is. Thanks for the help. if (isset($srch)){ if (strlen(trim($srch)) > 0) { $srch = strtoupper(trim($srch)); buildtable($srch); } else { dispwelcome(); } } else { dispwelcome(); } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.

« previous php.general (#98617) next »