$GET variable


Using get method, the data is carried out through the URL which is visible and is insecure when compared with post method. The data transferred through GET Method will be stored in the superglobal variable $_GET. This data submitted can be accessed in the form using GET Method by $_GET global variable.

Program for assigning $GET variable.
 <html>
 <body>
 <form name=“f1” method=“get” action="<?php echo
 $_SERVER['PHP_SELF'];?>
 Enter Roll<input type=“text” name=“t1”>
 <input type=“submit” value=“submit”>
 </form>
 <?php
 if ($_SERVER["REQUEST_METHOD"] == “get")
 {
 // collect value of input field
 $name = $_GET[‘t1'];
 echo $name;
 }
 ?>
 </body>
 </html>