Re: Server VS Client script validation

From: Date: Mon, 29 Jan 2001 23:14:03 +0000
Subject: Re: Server VS Client script validation
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-37174@lists.php.net to get a copy of this message
Make the form page post to itself and use default values of <?php echo $HTTP_POST_VARS['field_name'] ?>. The initial form will be blank, but subsequent failing attempts will have the values the visitor already entered. You can also add red text to the form to show what exactly was wrong, etc. Then, to handle posts that are successful, you'll need to use something like this: if (<successful post>) { // post is acceptable - process the info include("file/to/handle/post.php"); } else { // post failed ?> <!-- put HTML form page here --> <?php } // end if ?> I know some people might say this is bad style, but it works. It can be cleaned up some, but this is good enough IMO. --toby kaab kaoutar wrote: > > Hi! > What's best ? using client script while validating form inputs(javasript or > vbscript) or using php for validating! > with the first way, i can trigger alert ! however with the second one, i > have to show up a whole page for just saying that there are errors, go back > to the form ! > any ideas ? > thanks > > _________________________________________________________________________ > Get Your Private, Free E-mail from MSN Hotmail at > http://www.hotmail.com. > > -- > 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

« previous php.general (#37174) next »