On 13-07-28 01:14 PM, iccsi wrote:
<form action="action.php" method="post"> <p>Your name: <input type="text" name="name" /></p> <p>Your age: <input type="text" name="age" /></p> <p><input type="submit" /></p> </form>In the PHP tutorial manual, it says that we can have post action to the form itself just like above coding.I would like to know in the real projects, can we have action to the same PHP file, since that we only need have one filebut not 2 files foe POST request,Your help and information is great appreciated,regards,Iccsi,
From "my" experience, I would suggest that you ALWAYS post back to the same URL. All forms I've seen that post to a different target have issues when validation fails and they suddenly need to go back to the original form-- they tend to implement weird and not so wonderful techniques to get back to that form while preserving the posted data in the session or something. If they try to go back at all... some just say fail and tell you to hit your browser's back button.
Leaving the action attribute empty should cause the browser to post back to the same URL without you needing to re-iterate it programmatically in the action attribute.
Cheers, Rob. -- E-Mail Disclaimer: Information contained in this message and any attached documents is considered confidential and legally protected. This message is intended solely for the addressee(s). Disclosure, copying, and distribution are prohibited unless authorized. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php