Presentation is loading. Please wait.

Presentation is loading. Please wait.

HTML FORMS GET/POST METHODS. HTML FORMS HTML Forms HTML forms are used to pass data to a server. A form can contain input elements like text fields, checkboxes,

Similar presentations


Presentation on theme: "HTML FORMS GET/POST METHODS. HTML FORMS HTML Forms HTML forms are used to pass data to a server. A form can contain input elements like text fields, checkboxes,"— Presentation transcript:

1 HTML FORMS GET/POST METHODS

2 HTML FORMS HTML Forms HTML forms are used to pass data to a server. A form can contain input elements like text fields, checkboxes, radio-buttons, submit buttons and more.

3 HTML FORMS The tag is used to create an HTML form:. input elements.

4 The Input Element HTML Forms - The Input Element The most important form element is the input element. The input element is used to select user information. An input element can vary in many ways, depending on the type attribute. An input element can be of type text field, checkbox, password, radio button, submit button, and more. The most used input types are described below.

5 Textfields Text Fields defines a one-line input field that a user can enter text into: First name: Last name:

6 Password Password Field defines a password field: Password:

7 Radio Buttons defines a radio button. Radio buttons let a user select ONLY ONE of a limited number of choices: Male Female

8 Checkboxes Checkboxes defines a checkbox. Checkboxes let a user select ONE or MORE options of a limited number of choices. I have a bike I have a car

9 Submit Button defines a submit button. A submit button is used to send form data to a server. The data is sent to the page specified in the form's action attribute. The file defined in the action attribute usually does something with the received input:

10 Submit Button Username:

11 GET AND POST METHODS We can send data to the data processing page by both the GET and POST methods of a form. Both methods are used in form data handling where each one has some difference on the way they work. GETPOST

12 GET In GET method data gets transferred to the processing page in name value pairs through URL, so it is exposed and can be easily traced by visiting history pages of the browser. So any login details with password should never be posted by using GET method.

13 GET Username: Data is send thru the URL http://127.0.0.1/cms/misc/object.html?user=thismyuse rname

14 Difference of GET and POST As you have seen there is a character restriction of 255 in the URL. This is mostly the old browsers restriction and new ones can handle more than that. But we can't be sure that all our visitors are using new browsers. So when we show a text area or a text box asking users to enter some data, then there will be a problem if more data is entered. This restriction is not there in POST method.

15 POST The Post method is more powerful request. By using Post we can request as well as send some data to the server. We use post method when we have to send a big chunk of data to the server, like when we have to send a long enquiry form then we can send it by using the post method.

16 PHP POST and GET POST GET

17 PHP POST This HTML code specifies that the form data will be submitted to the "form.php" web page using the POST method. The way that PHP does this is to store all the "posted" values into an associative array called "$_POST". Be sure to take notice the names of the form data names, as they represent the keys in the "$_POST" associative array. $ content = $_POST[‘content '];

18 The get method is different in that it passes the variables along to the “article.php" web page by appending them onto the end of the URL. The URL, after clicking submit, would have this added on to the end of it: “article.php"?%93content%22=foofoofoo The question mark "?" tells the browser that the following items are variables. Now that we changed the method of sending information on "order.html", we must change the “article.php" code to use the "$_GET" associative array.


Download ppt "HTML FORMS GET/POST METHODS. HTML FORMS HTML Forms HTML forms are used to pass data to a server. A form can contain input elements like text fields, checkboxes,"

Similar presentations


Ads by Google