Home Tutorial Php Phpbeginning PHP HTML Form Method Attribute

 
 

Share on Google+Share on Google+
PHP HTML Form Method Attribute
Posted on: January 29, 2010 at 12:00 AM
Advertisement
The second attribute in the form tag is Method. With the help of Method attribute, we can tell the browser that how the form information should be sent. Let's see how we used in our form :

Topic : PHP HTML Form Method Attribute

Part - 3

The second attribute in the form tag is Method. With the help of Method attribute, we can tell the browser that how the form information should be sent. Let's see how we used in our form :

<form action="dislay.php" method=""> 

In the above code we used the method blank. There are two most popular method to send the information from one page to page that is : 

A. Get Method

B. Post Method

 

A. Get Method

<form action="dislay.php" method="get"> 

In the above code, we mentioned the method get and let's check it out how it will effect to the browser.  Save your task and then click to the Submit button.

The output of the above code is :

http://localhost/PHP%20HTML%20FORM/basic_form.php?userid=surajmittal%40roseindia.com&pass=11445566&submit=Submit

If you noticed that your whole confidential information goes into the URL in the above. This is a penalty you have to pay when you used the method post. The data from the form ends up in the address bar and you will find a question mark, followed by form data.

The Get method returned the whole information in the URL sent by the user. You can use get method when the information is returned is not important that needs to hide from others.

B. Post Method

<form action="dislay.php" method="post"> 

In the above code, we mentioned the method post and let's check it out how it will effect to the browser. Save your task and then click to the Submit button.

The output of the above code is :

http://localhost/PHP%20HTML%20FORM/basic_form.php

Using POST method is the guarantee that the form information won't get visible to the user in the URL. In our Html Form tutorial we will use both POST and GET in different way but it depends on the project if the information that is send through these method are sensitive or not. If the information is sensitive then we will use POST method otherwise GET method. 

In the next part of this tutorial, we will give a look to Submit button, how it works with the form.

Advertisement

Related Tags for PHP HTML Form Method Attribute:


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: January 29, 2010

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com