PHP Forms Explained

Last Update: May 14, 2015

In this article we’re not going to explain you about the depths of php forms or give code to work on, but you’re going to get an idea how php methods work with forms. There are 2 ways php can interact with forms.

 

 

GET Method

This method uses the predefined $_GET variable which gets the submitted data on forms and pastes it to the URL. This method is not commonly used because it displays the information to everyone including sensitive information like passwords. There’s also a character limit of 2000.

 

 

Example



After clicking subscribe and thinking you’re safe, checkout how the url is shown with th GET method.




That’s why using the GET method for web forms is unsecure. You can also view the form entries in any page you like and paste in HTML codes with the GET method.

php-forms2


The following method is used more commonly on php forms because the information sent is not visible to others.

 

 

POST Method

This method uses the predefined $_POST variable which doesn’t post the data from a form to the URL and as mentioned above it is better to use this method for sensitive information collecting. There’s no limits on the amount of data to be sent from forms.

 

 

Example



After clicking login, checkout how the data isn’t posted to the URL unlike the GET method.

php-forms-url2


You can also collect the form data and paste it in HTML like the GET method.

php-forms2


As you can see, there are advantages and disadvantages of using these methods. However, in short, this is why these forms are called “PHP Forms”. Forms that use PHP to capture and post data in an easy way.



Send Comment