Loading...
PHP

Get, Post and Request

$_GET:  By using super global variable we can get the posted values of method it is array variable the total number of elements are equal to the total number of posted values
Element is are in the names of control element value of control element and values of control
<form method= “get” action= “page2.php”>
<input type= “text” name= “text1”>< <br>
<input type= “text” name= “text2”> <br>
<input type= “submit” value= “Go” name= “sub”>
</form>
(Save–>page2.php)
<?php
//print_r($_GET);
echo $_GET[‘txt1’];
echo $_GET[‘txt2’];
?>

$_POST: It is same as $_GET but we can get the posted values of post method
Example:
<form method= “post” action= “page2.php”>
<input type= “text” name= “text1”>< <br>
<input type= “text” name= “text2”> <br>
<input type= “submit” value= “Go” name= “sub”>
</form>
(Save–>page2.php)
<?php
//print_r($_post);
echo $_POST[‘txt1’];
echo $_POST[‘txt2’];
?>

$_REQUEST: By using this super global variable we can get posted values of both Get method and Post method. we can also get values of Coolie and QUERY String.

Leave a Reply

Your email address will not be published. Required fields are marked *