Breaking

LightBlog

Saturday 4 July 2015

PHP GET & POST


$_GET Array: The $_GET variable is used to collect values from a form with method =”get”. The $_GET variable is an array of variable names and values sent by the HTTP GET method.
The $_GET variable is used to collect values from a form with method=”get”. Information is sent from a form with the GET method is visible to everyone in address bar of browser. It sent the limited of data and not secure in contact form.       
                                              
                        

Program
<html>
<body>
<form action=""  method="get">
Name :<input name="fname" type="text" />
Age :<input name="age" type="text" />
<input name="button" type="button" value="submit" />
</form>
Welcome <?php echo $_GET['fname'];?>.<BR/>
My age is <?php echo $_GET['age'];?>.<BR />
</body>
</html>

Here Video Tutorial

                                   
$_POST Array: $_POST is second method for passing data one page to another page in PHP script. It just like work $_GET method. In the $_GET variable we cannot pass lot of data while by the $_POST variable we can send data from one page to another page like Registration page or contact form etc.it can use to send the large amount of data compare the $_GET. And it sends the secure data from one page to another. It hides the information in Address Bar. It work hidden side and after click on submit this data store in $_POST variable one by one.
                                        

    
Program
<html>
<body>
<form action="demo2.php"  method="get">
Name :<input name="fname" type="text" />
Age :<input name="age" type="text" />
<input name="button" type="button" value="submit" />


Second file you can save demo2.php

 <?php echo $_POST['fname']. “<BR/>”;
  echo $_POST['age']. “<BR />”;
?>

Here Video Tutorial

                               
Adbox