<!DOCTYPE html>
<html>
<head>
<title>PHP POST Method</title>
</head>
<style type="text/css">
.basic_form{ padding:5px 10px; border-radius:2px; margin:10px 0px 5px;}
.cus_btn{ padding:6px 15px; background:#0099da; color:#FFF;}
.cus_btn_1{ padding:6px 15px; background:#F30; color:#FFF;}
</style>
<body>
<form action="post_method_link.php" method="post">
<input type="text" name="name" class="basic_form" placeholder="Name" /><br />
<input type="email" name="email_id" class="basic_form" placeholder="example@gmail.com" /><br />
<input type="number" name="mobile" class="basic_form" placeholder="996X666X68" /><br />
<textarea rows="3" cols="40" name="message" class="basic_form" placeholder="Message"></textarea><br />
<input type="submit" value="SUBMIT" class="cus_btn" />
<input type="reset" value="CLEAR" class="cus_btn_1" />
</form>
</body>
</html>
post_method_link.php
". The form data is sent with the HTTP POST method.
<!DOCTYPE html>
<html>
<head>
<title>PHP POST Method</title>
</head>
<body>
<h2>Welcome To <?php echo $_POST["name"]; ?></h2>
<h4>Email Id : <?php echo $_POST["email_id"]; ?></h4>
<h4>Mobile No : <?php echo $_POST["mobile"]; ?></h4>
<h4>Message : <?php echo $_POST["message"]; ?></h4>
</body>
</html>
This is the built in PHP super global array variable that is used to get values submitted via HTTP GET method.
The array variable can be accessed from any script in the program; it has a global scope.
This method displays the form values in the URL.
<!DOCTYPE html>
<html>
<head>
<title>PHP GET Method</title>
</head>
<style type="text/css">
.basic_form{ padding:5px 10px; border-radius:2px; margin:10px 0px 5px;}
.cus_btn{ padding:6px 15px; background:#0099da; color:#FFF;}
.cus_btn_1{ padding:6px 15px; background:#F30; color:#FFF;}
</style>
<body>
<form action="get_method_link.php" method="get">
<input type="text" name="name" class="basic_form" placeholder="Name" /><br />
<input type="email" name="email_id" class="basic_form" placeholder="example@gmail.com" /><br />
<input type="number" name="mobile" class="basic_form" placeholder="996X666X68" /><br />
<textarea rows="3" cols="40" name="message" class="basic_form" placeholder="Message"></textarea><br />
<input type="submit" value="SUBMIT" class="cus_btn" />
<input type="reset" value="CLEAR" class="cus_btn_1" />
</form>
</body>
</html>
get_method_link.php
".
<!DOCTYPE html>
<html>
<head>
<title>PHP GET Method</title>
</head>
<body>
<h2>Welcome To <?php echo $_GET["name"]; ?></h2>
<h4>Email Id : <?php echo $_GET["email_id"]; ?></h4>
<h4>Mobile No : <?php echo $_GET["mobile"]; ?></h4>
<h4>Message : <?php echo $_GET["message"]; ?></h4>
</body>
</html>