Re: single page form
| From: | Joe Lloyd | Date: | Thu, 26 Oct 2000 04:14:47 +0000 |
| Subject: | Re: single page form | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-3912@lists.php.net to get a copy of this message | ||
Basically it comes down to a big if-then-else. PHP will automatically
create variables with the same names as are in your form. Here's a quick
example:
<HTML>
<HEAD><TITLE>Form</TITLE></HEAD>
<BODY>
<?
if ($submit) { // Check if the submit button was pressed
echo "Hello: $name<BR>\n"; // print out the name
} else { //No submit button, so give them the form
?>
<FORM ACTION="<? echo $PHP_SELF ?>" METHOD=POST>
<INPUT TYPE="text" NAME="name">
<INPUT TYPE="submit" VALUE="Who am I" NAME="submit">
</FORM>
<?
} // Need to close the if
?>
"Adv. Systems Design" wrote:
> Hello:
>
> I think this must be a FAQ...I see alot of PHP forms
> that gather user input without calling another page
> (it calls itself), all the while passing the collected
> variables to the url string...does anyone have a form
> like that where I could see the structure? What is the
> basic logic in a page like that?
>
> If you could point me to some source that could be
> dissected I would really appreciate it...
>
> Thanks
> Luis
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Messenger - Talk while you surf! It's FREE.
> http://im.yahoo.com/
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
> For additional commands, e-mail: php-db-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net