View Full Version : action=\"$_SERVER[PHP_SELF]\">
expmsr
08-12-2010, 12:54 PM
i will be very pleased if anyone will explain me the meaning of the syntax above. thank you.
bluewalrus
08-12-2010, 02:06 PM
It's probably sending the form data back to the same page it is on.
http://php.net/manual/en/reserved.variables.server.php
The filename of the currently executing script, relative to the document root. For instance, $_SERVER['PHP_SELF'] in a script at the address http://example.com/test.php/foo.bar would be /test.php/foo.bar. The __FILE__ constant contains the full path and filename of the current (i.e. included) file. If PHP is running as a command-line processor this variable contains the script name since PHP 4.3.0. Previously it was not available.
djr33
08-12-2010, 03:21 PM
While I'm not positive this is entirely valid, setting the action to an empty string does the same thing:
<form action="" .....>
(In other cases, those server variables are useful, but if you aren't doing anything fancy with the action, a "blank" action should be fine.)
You could also remove all "get" variables like this:
<form action="?" ....>
That's actually what I use on most of my forms, and the only problem is that there's an extra (annoying) question mark at the end. But usually this helps because it gives a new URL for the submitted form.
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.