note 27404 deleted from tutorial.forms by philip
| From: | philip@php.net | Date: | Mon, 27 Jan 2003 19:19:18 +0000 |
| Subject: | note 27404 deleted from tutorial.forms by philip | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-42872@lists.php.net to get a copy of this message | ||
when using the post method for a form, you have the ability to call the variables directly by name
without using $_REQUEST,$_POST,$_GET on the variable. If you enclose the entire webpage in one big
<?php tag and call the page itself, you can just call a variable by its name and get the sent
value.
Example:
Enitre php page enclosed in one php tag!
<?
echo "
<HTML>
<body>
<form action=\"?\" method=\"POST\">
Your name: <input type=\"text\" name=\"name\">
Your age: <input type=\"text\" name=\"age\">
<input type=\"submit\" value=\"Submit\" name=\"sent\">
</form>
";
if (!isset($sent)){
echo "Name and Age not set!";
}
else{
echo "Name $name and Age $age";
}
echo "</body></html>";
?>
For functions within the code, you'd have to pass the variable. This is only for simple code.