|
|
|
A major problem people have in designing / creating forms is to decide whether to use the GET or POST methods.
GET:
-----
1. URL Changes to the submitted script name, appended with a list
of each variable with the value.
2. Use only if the number of variable to be used in a form ar very less.
3. Never use GET forms when asking for login ID and passwords.
4. Even hidden variables are shown as a part of the URL.
5. A lot of webservers might complain about long URLs being submitted.
A lot of times a URL 255 char or more is a problem.
POST:
-----
1. This is the best way of submitting forms to the web server.
2. There is no limitation on the number of Variables passed from the form.
3. This is a transparent way of transmitting variables to the webserver
where hidden variable are always hidden!
Usage Example
| <form method="GET" action="testform.phtml">
<input type="hidden" name="id" value="101">
<input type="image" name="userselected" value="ProcessNow" src="../images/testbutton.gif" >
</form> | |
Once the form is submitted, the URL will show as below:
http://www.mywebsite.com/tests/testform.phtml?
id=101&userselected=ProcessNow&userselected.x=130&userselected.y=42
Notice how the 'id' is shown as a part of the URL. This is not always what you might have wanted. So, here the length of the URL should not be > 255 characters for it to be processed properly by all webservers.
Usage Example
| <form method="POST" action="testform.phtml">
<input type="hidden" name="id" value="101">
<input type="image" name="userselected" value="ProcessNow" src="../images/testbutton.gif" >
</form> | |
Once the form is submitted, the URL will still show:
http://www.mywebsite.com/tests/testform.phtml
while the form variable id and userselected will be passed to the server transparently.
|
|
| This script shows you the 7th latest php items from the mailing list archive on zend.com Categories : HTML, HTML and PHP, HTTP, PHP | | | The first step Guest Book ... ^^ Categories : MySQL, PHP, Apache, HTML, HTTP | | | Script to check values being submitted by POST or GET method from a form. This script may help diagnose what variables are being supplied by a browser to other php scripts. Categories : HTML, Variables, Debugging, PHP, HTTP | | | color codes for positive and negative numbers Categories : PHP, MySQL, Databases, HTML | | | Parses HTTP_USER_AGENT so that you can customize your site to different browsers Categories : HTML, PHP, Complete Programs | | | How to use META REFRESH to auto refresh an html page
after x seconds. Categories : HTML | | | FormWizard reads a mysql table and generates automatically
a html formular in a html-table Categories : PHP, MySQL, HTML | | | Allows you to parse a deliniated string and put the individual fields in a SELECT option in a form Categories : HTML, PHP, Strings | | | Clock at Status Bar Categories : Java Script, HTML, Date Time | | | Simple Password example Categories : PHP, Authentication, Security, HTTP | | | Browser Detecor Class Categories : PHP Classes, PHP, HTML | | | Unobtrusive javascript for maintaining scrollable layer state Categories : DHTML, Java Script, HTML | | | Display Slashdot headers on your own site Categories : HTML and PHP, HTML, PHP | | | Gets the browser and OS from the $_SERVER['http_user_agent'] variable in PHP Categories : PHP, HTTP, Regexps | | | BBCode Formatting String Categories : PHP, HTML, Regexps, Arrays | |
|
|
|