Archive:PHP and MySQL Programming/Form Handling: Difference between revisions

No edit summary
No edit summary
Line 20: Line 20:
  </BODY>
  </BODY>
  </HTML>
  </HTML>
<FORM method='POST'>
username : <INPUT type='text' name='username'> <BR>
password : <INPUT type='password' name='password'> <BR>
<INPUT type='submit' value='GO'>
</FORM>


The above example sets up a form with a `method` and an `action` attribute. The `method` defines how the data from the form is to be transferred to the page defined by `action`. The `method` can either be GET or POST. If GET is used, then all the form elements will be appended to the url of the target page (`action`), in this format : target?attrib1=val1&attrib2=val2&attrib3=val3 etc... These attributes are easily accessed in PHP by using the $_GET[] array variable;
The above example sets up a form with a `method` and an `action` attribute. The `method` defines how the data from the form is to be transferred to the page defined by `action`. The `method` can either be GET or POST. If GET is used, then all the form elements will be appended to the url of the target page (`action`), in this format : target?attrib1=val1&attrib2=val2&attrib3=val3 etc... These attributes are easily accessed in PHP by using the $_GET[] array variable;