⊗ppPmFmFSM 295 of 447 menu

Form Submission Method in PHP

Using the method attribute we specify the form submission method. It can be GET or POST.

Let our form be submitted using the GET method to the page result.php:

<form action="/result.php" method="GET"> <input name="test1"> <input name="test2"> <input type="submit"> </form>

In this case, on this page in the address bar, the form data will appear in the following format: after the page address there will be a sign ?, and after it the names of the inputs and the values entered by the user: result.php?test1=value1&test2=value2.

Let our form be submitted using the POST method to the page result.php. In this case, the data will also be sent, but will not be displayed in the address bar:

<form action="/result.php" method="POST"> <input name="test1"> <input name="test2"> <input type="submit"> </form>

On the page index.php, make a form. Submit it to the page result.php. Test both form submission methods.

byenru