RE: [PHP] Thoughts on a simple search engine...

From: Date: Tue, 24 Sep 2002 20:04:09 +0000
Subject: RE: [PHP] Thoughts on a simple search engine...
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-117471@lists.php.net to get a copy of this message
Chuck, Setup your form like this (assuming search.php is the name of your page): <FORM ACTION="search.php" METHOD="post"> <INPUT TYPE="hidden" NAME="step" VALUE="2"> ..... </FORM> Then in your search.php page, use this structure: # --- set $step to passed value, or else set to default ---
if (isset($_GET["step"]))       { $step=$_GET["step"]; }
elseif (isset($_POST["step"])) { $step=$_POST["step"]; }
else                            { $step="1"; }
if ($step==2) {
        # --- do the Search query and display results here ---
        # after displaying, then set step=1  to force the search form to come up again at the bottom of the page
        $step=1;
} if ($step==1) {
        # --- put the form here...  ---
} I use the "step" variable all the time in controlling page flow, and allowing me to re-use the same .php file for many similar purposes to keep the file count of the site low. HTH, Peter At 02:13 PM 9/24/2002 -0500, Jay Blanchard wrote:
[snip] So I if I create the form, is there way that I can have it echo on the same page if I am using a form? [/snip] Yes, using $PHP_SELF as your form action HTH Jay "Ever stop to think, and forget to start again?" *****************************************************
* Texas PHP Developers Conf  Spring 2003            *
* T Bar M Resort & Conference Center                *
* New Braunfels, Texas                              *
* Contact jay.blanchard@niicommunications.com       *
*                                                   *
* Want to present a paper or workshop? Contact now! * ***************************************************** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
- - - - - - - - - - - - - - - - - - - - - Fourth Realm Solutions pbechard@fourthrealm.com http://www.fourthrealm.com Tel: 519-739-1652 - - - - - - - - - - - - - - - - - - - - -

« previous php.general (#117471) next »