How to use PHP & POST Method ($_POST,$HTTP_POST_VARS) Learn PHP how to using POST method and read a php variable from $_POST method.
ShotDev Focus:
- Using PHP & $_POST method.
Example
php_post1.php
<html> <head> <title>ShotDev.Com Tutorial</title> </head> <body> <form action="php_post2.php" method="post" name="form1"> Name <input name="txtName" type="text"> SiteName <input name="txtSiteName" type="text"> <input type="submit" name="Submit" value="Submit"> </form> </body> </html>
php_post2.php
<html> <head> <title>ShotDev.Com Tutorial</title> </head> <body> <?php echo $_POST["txtName"]."<br>"; // txtName echo $_POST["txtSiteName"]."<br>"; // txtSiteName echo "<hr>"; foreach($_POST as $key => $val) // All Key & Value { echo $key . " : " . $val . "<br>"; } ?> </body> </html>
Create a php file and save to path root-path/myphp/
Run
http://localhost/myphp/php_post1.php
Screenshot
.
.
.