WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDES  |  PHP CLASSES  |  CODE SEARCH  |  ARTICLES SEARCH  |  PHP FORUMS  |  PHP MANUAL  |  PHP FUNCTIONS LIST  |  WEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Submit Your Code
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
WeberDev's Monthly code contest PHP Code Contest
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Index
PHP Web Logs (BLogs)
Web Development Resources
Web Development Content
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
Submit Site
Forex Trading Online forex trading platform

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : Difference between POST and GET methods of Submitting Forms
Categories : HTML, HTTP Click here to Update Your Picture
Narendra Jain
Date : May 03rd 2004
Grade : 3 of 5 (graded 4 times)
Viewed : 11900
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Narendra Jain
Action : Grade This Code Example
Tools : My Examples List

  Submit your own code examples 
 

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