PHP POST method



User Rating:  / 0
PoorBest 
Details
Category: php
Created on Tuesday, 11 December 2012 15:06
Last Updated on Tuesday, 11 December 2012 15:10
Published on Tuesday, 11 December 2012 15:06
Written by Administrator
Hits: 8534

The POST method transfers information via HTTP headers. The information is encoded as described in case of GET method and put into a header called QUERY_STRING.

example :

file post.html

View source
<html>
<body>
 www.developerpages.gr <br><br>
 <form action="post.php" method="POST">
 First Name: <input type="text" name="firstname" /> <br>
 Last Name: <input type="text" name="lastname" /> <br>
 <input type="submit" />
 </form>
</body>
</html>

file post.php

View source
<?php
 
 
if( $_POST["firstname"] || $_POST["lastname"] )
 {
 echo "Welcome ". $_POST['firstname']. " ". $_POST['lastname']. "<br />";
 exit();
 }
?>