Learning & Integrating web technology and code help directory

How to use PHP & POST Method ($_POST,$HTTP_POST_VARS)

No comments
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

  1. <html>  
  2. <head>  
  3. <title>ShotDev.Com Tutorial</title>  
  4. </head>  
  5. <body>  
  6. <form action="php_post2.php" method="post" name="form1">  
  7. Name  
  8. <input name="txtName" type="text">  
  9. SiteName  
  10. <input name="txtSiteName" type="text">  
  11. <input type="submit" name="Submit" value="Submit">  
  12. </form>  
  13. </body>  
  14. </html>  
php_post2.php

  1. <html>  
  2. <head>  
  3. <title>ShotDev.Com Tutorial</title>  
  4. </head>  
  5. <body>  
  6. <?php  
  7. echo $_POST["txtName"]."<br>"// txtName  
  8. echo $_POST["txtSiteName"]."<br>"// txtSiteName  
  9. echo "<hr>";  
  10.   
  11. foreach($_POST as $key => $val// All Key & Value  
  12. {  
  13. echo $key . " : " . $val . "<br>";  
  14. }  
  15. ?>  
  16. </body>  
  17. </html>  
Create a php file and save to path root-path/myphp/
Screenshot
PHP POST
PHP POST
.
.
.
Download this script.
Download

No comments :

Post a Comment