Hi,
Is there any difference between these 2 in php?
1. <form action="" method="post" form>
2. <form action="$_SERVER["php_self"]" method="post" form>
In both the cases ,the form calls the same form itself.is there any difference between the 2?
thanks for any help
Value for action in form
Moderator: General Moderators
- jayshields
- DevNet Resident
- Posts: 1912
- Joined: Mon Aug 22, 2005 12:11 pm
- Location: Leeds/Manchester, England
Re: Value for action in form
$_SERVER['PHP_SELF'] returns...
In most cases, both of your examples will result in the same thing.
As a side note, you don't need to have "form" after the method attribute.
Whereas, as far as I know, a blank action attribute is the same as the attribute being set to "#".PHP Manual wrote: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.
In most cases, both of your examples will result in the same thing.
As a side note, you don't need to have "form" after the method attribute.