Re: Empty form
| From: | Steven Walker | Date: | Fri, 15 Feb 2002 19:29:48 +0000 |
| Subject: | Re: Empty form | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-84966@lists.php.net to get a copy of this message | ||
Ben,
I've been dealing with this problem recently. The solution I found works great in my case... the data processing page is the same as the form page.
When the page is loaded it tests for post data. If no data is available (ie !isset($name)), then the form will be displayed. When the user submits the form, it actually submits it to the same page ($PHP_SELF). This way, no matter how many times the user makes mistakes, your page will faithfully redisplay the form until they get it right. You can even build in special formatting, such as highlighting missing or incorrect fields.
When the post data is verified, the page can display the next page by using an include() or header() redirect, and bypass the form.
I hope this helps.
Steven J. Walker
Walker Effects
www.walkereffects.com
steve@walkereffects.com
On Friday, February 15, 2002, at 12:24 AM, Ben Clumeck wrote:
I am trying to have my form redirect back to my form, if the 'name' field is
not filled in or the submit button is not pushed. Can someone tell me what
my problem is with the script below that I have in my header:
<?
if(!isset($name)||($HTTP_POST_VARS[submit]))
{
header("Location: form.htm");
}
?>
Thanks,
Ben
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php