PHP Display All Form Variables


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. function display_post_get() {
  2. if ($_POST) {
  3. echo "Displaying POST Variables: <br> \n";
  4. echo "<table border=1> \n";
  5. echo " <tr> \n";
  6. echo " <td><b>result_name </b></td> \n ";
  7. echo " <td><b>result_val </b></td> \n ";
  8. echo " </tr> \n";
  9. while (list($result_nme, $result_val) = each($_POST)) {
  10. echo " <tr> \n";
  11. echo " <td> $result_nme </td> \n";
  12. echo " <td> $result_val </td> \n";
  13. echo " </tr> \n";
  14. }
  15. echo "</table> \n";
  16. }
  17. if ($_GET) {
  18. echo "Displaying GET Variables: <br> \n";
  19. echo "<table border=1> \n";
  20. echo " <tr> \n";
  21. echo " <td><b>result_name </b></td> \n ";
  22. echo " <td><b>result_val </b></td> \n ";
  23. echo " </tr> \n";
  24. while (list($result_nme, $result_val) = each($_GET)) {
  25. echo " <tr> \n";
  26. echo " <td> $result_nme </td> \n";
  27. echo " <td> $result_val </td> \n";
  28. echo " </tr> \n";
  29. }
  30. echo "</table> \n";
  31. }
  32. }
  33. // End of display_post_get

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.