Tuesday, 31 January 2017

$_GET IN PHP

By using this super global variable we can get posted values of get method. It is array datatype. Total numbers of elements are equal to total number of posted values. Element keys are control names, element values are control values.

Example –

form.html
<form method="get" action="p1.php">
<input type="text" name="t1"><br>
<input type="text" name="t2"><br>
<input type="submit" name="Sub" value="Click">
</form>

p1.php
<?php
print_r($_GET);
echo $_GET['t1'];
echo $_GET['t2'];
?>

Output –

Array ( [t1] => rakesh [t2] => kumar [Sub] => Click ) rakeshkumar

No comments:

Post a Comment