Friday, 7 August 2015

The PHP $_GET and $_POST CONCEPT

04:36

The PHP  superglobals   $_GET and $_POST are used to collect form-data.

(1)Method=get  and  $_GET  :

(a)html file   “form.html”:
<html>
<head>
<title>form</title>
</head>
<body>
<form   action="get.php"   method="get">
Name<input type="text" name="name">
contact<input type="text" name ="contact">
address<textarea rows="5" cols="20" name="address"></textarea>
<input type="submit" name="submit" value="post">
</form>
</body>
</html>

(b) file      “get.php”:
<?php
$name=$_GET['name'];
$contact=$_GET['contact'];
$address=$_GET['address'];
echo $name.'<br>';
echo $contact.'<br>';
echo $address.'<br>';
?>

(2)Method=POST    and   $_POST   :

(a)html file    “form.html”:
<html>
<head>
<title>form</title>
</head>
<body>
<form   action="post.php"   method="post">
Name<input type="text" name="name">
contact<input type="text" name ="contact">
address<textarea  rows="5" cols="20" name="address"></textarea>
<input type="submit" name="submit" value="post">
</form>
</body>
</html>

(b) file       “post.php” :
<?php
$name=$_POST['name'];
$contact=$_POST['contact'];
$address=$_POST['address'];
echo $name.'<br>';
echo $contact.'<br>';
echo $address.'<br>';
?>



Written by

We are Creative Blogger Theme Wavers which provides user friendly, effective and easy to use themes. Each support has free and providing HD support screen casting.

0 comments:

Post a Comment

PHP Training Mumbai, PHP MySQL Training Mumbai, PHP Course Mumbai, PHP Institute Mumbai

 

© 2013 PHP TRAINING IN MUMBAI BY OM SIR . All rights resevered. Designed by OM SIR

Back To Top