PHP get method and data collection

, by Prashant Gunjal

The alternative to the post method is get.The get method is different in that it passes the variables along to the action  web page by appending them onto the end of the URL.
Using the get method displays the variable information to your visitor, so be sure you are not sending password information or other sensitive items with the get method. You would not want your visitors seeing something they are not supposed to!

Program :

14 . html
<html>
<head>
<title>GET METHOD</title>
</head>
<body>
<form method="get" action="14.php">
Enter First Name : <input type="text" name="fname"><br>
Enter Last Name : <input type ="text" name="lname" ><br>
<input type="submit" value="CLICK HERE">
</form>
</body>
</html>

File 14.php

<?PHP
    $fname=$_GET['fname'];
    $lname=$_GET['lname'];
    echo "First name is $fname and last name is $lname";
?>

OUTPUT :


0 comments: