Re: form challenge
| From: | Jon Parise | Date: | Mon, 10 Jul 2000 21:55:49 +0000 |
| Subject: | Re: form challenge | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-5822@lists.php.net to get a copy of this message | ||
On Mon, Jul 10, 2000 at 09:16:42PM +0200, Marcel Martin wrote:
> > <? for( $i = 0; $i < $x; $i++ ) { ?>
> > <form method="post" action="<? echo $PHP_SELF ?>">
> > <input type=text> <input type=submit>
> > </form>
> > <? } ?>
>
> AFAIK the "action" in a <form> tag defaults to the current URL. I'v seen
> a few scripts where the action was set to $PHP_SELF (like in the example
> above) explicitly, instead of being left out. Is this "better" or even
> necessary for some browsers? Or do most people just not know about this
> behavior? (like I did just a few days ago :-) )?
I prefer the above approach (use $PHP_SELF). It's portable across
multiple source files that way, and it makes the resulting HTML output
easier to debug. I don't like making assumptions on browser behavior.
--
Jon Parise (jon@csh.rit.edu) . Rochester Inst. of Technology
http://www.csh.rit.edu/~jon/ : Computer Science House
Member