Printing PHP variables from GET or POST forms

Last modified: October 6, 2006 - 02:37

PLEASE NOTE These snippets are user submitted. Use at your own risk.

<?php
/**
* this Snippet illustrates how you display the values of a submitted form
* in a Drupal page.
*
* Submitted by puregin
*
* This works with drupal 4.5 and drupal 4.6
*/

print "variable1: " . $_POST["variable1"] ."<br/>";
print
"product: " . $_POST["product"] ."<br/>";
print
"size: " . $_POST["size"] ."<br/>";
?>

NOTES:

Change $_POST to $_GET if you used GET as your form method or if you are using a URL to set the variables. (e.g., example.com/page.php?variable1=hello)

 
 

Drupal is a registered trademark of Dries Buytaert.