Re: Forms and PHP_SELF

From: Date: Sun, 06 Jul 2003 00:34:27 +0000
Subject: Re: Forms and PHP_SELF
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-154100@lists.php.net to get a copy of this message
Be careful when using PHP self. Not all servers support it. If you're planning on using this script over and over on multiple servers you may find creating a variable is helpful. $some_variable = "the_script_name.php"; Then, where you would use PHP_SELF just echo (or whatever) $some_variable. You will have to change it if the script name changes, but otherwise it's just a relative path. -Dan On Sat, 2003-07-05 at 19:43, Beauford.2005 wrote: > Hi, > > I have a very simple form that searches a MySQL database and I want to > be able to have the search appear on the same page as the search. > > <FORM NAME="search" METHOD="post" ACTION="<? $PHP_SELF; > ?>"> > <INPUT type=text size=30 name=player> > <INPUT TYPE="image" src="../images/submit.gif" > width="75" > height"30" value="submit"> > </FORM> > > The part that confuses me is how I run the code for the search. > Currently I have it in a function and at the top of the script I have an > IF statement that checks to see if the submit button has been pressed, > if it has I go to the function. This is not working, and I'm not even > sure this is the right way to go about it. > > I'm probably doing this wrong and would appreciate it if someone could > set me straight. >

« previous php.general (#154100) next »