RE: [PHP] Forms and Results with PHP
| From: | Gareth Hastings | Date: | Thu, 06 Dec 2001 22:38:35 +0000 |
| Subject: | RE: [PHP] Forms and Results with PHP | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-76958@lists.php.net to get a copy of this message | ||
I do forms like this
<?
if (!empty($data))
{
echo "You entered $data";
}
else
{
?>
<form action="<?= $SCRIPT_NAME ?>" method="post">
<input type="text" name="data">
</form>
<?
}
?>
The if line just checks to see if any data has been passed if it has it
prints what you send else if shows the form
-----Original Message-----
From: Ben Clumeck [mailto:bclumeck@home.com]
Sent: 06 December 2001 17:14
To: php-general@lists.php.net
Subject: [PHP] Forms and Results with PHP
I have a form that a user can put his contact info. This form posts to
a
file called results.php. The results.php file has a mail() command and
the
echo (i.e. <? echo "$name"; ?>) to show the user confirmation of what
he
has submitted.
However, if someone goes directly to results.php it will show Name:
blank
and email blank information. Is there a way for the page to post an
error
stating no information was submitted or is there a way to enable the
page to
process without information?
Thanks for the help,
Ben
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net