Home and Learn: PHP Programming Course
In the previous section, you saw what happened in the browser's address bar when you used the GET method for Form data. The alternative to GET is to use POST. Change the first line of your FORM to this:
<FORM NAME ="form1" METHOD ="POST" ACTION = "">
Close your browser down, and open it back up. Load your basicForm.php page again, and then click the button. Your address bar will then look like this:
The ?Submit1=Login part from the previous section is now gone! That is because we used POST as the method. Using POST means that the form data won't get appended to the address in the address bar for all to see. We'll use both POST and GET throughout the book. But it depends on the project: if the data is not sensitive then use GET, otherwise use POST.
Another important attribute of the Form tag is Action. Without Action, your forms won't go anywhere! We'll see how this works in the next part.
Email us: enquiry at homeandlearn.co.uk