How to Use GET Method in php

PHP

There are three types of form methods GET,POST and REQUEST. Get method is not used more because it has a drawback. When the form is submit then all the fields data are displayed in url with the variable name and its value , hence every one can see the fields and it can be risky. There cant be any Privacy. Url has 255 length to hold the string so some time big string can create problems. We need to set form type as GET so the get method will be applicable when the form is submitted.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Example for Using GET Method in PHP</title>
</head>
<body>
<!--We will create one simple form with two fields first name and last name-->
<!--This is the simple example for get method with form in php-->
<!-- We need to set method="get" for the Get Method-->
<form name="myform" action="" method="get" id="myform">
<p>
<label>First Name</label>
<input type="text" name="fname" id="fname" value="" />
</p>

<p>
<label>Last Name</label>
<input type="text" name="lname" id="lname" value="" />
</p>
<p>
<input type="submit" value="Submit" name="save" id="save" />
</p>

</form>
<?php
if(isset($_GET['save']))
{
echo 'Your Name-'.$_GET['fname'].' '.$_GET['lname'];
}
?>
</body>
</html>
-->