Re: Using PHP Variables with a Header

From: Date: Tue, 10 Jul 2001 01:01:12 +0000
Subject: Re: Using PHP Variables with a Header
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-57047@lists.php.net to get a copy of this message
the way i would do this is to have the form validation on the same page as the form and when user input has been validated the require another script (keeps global variables) you could try something like this <?php if($submit){
        $error_addr = "";
        //form validation
        if ($user_input == "ok"){
                require("step2.php");
                exit();
        }
        $user_input_error = "<font color=red> user_input must = ok </font>";
} ?> <html> <head></head> <body> <form> <?php echo($user_input_error) ?> <input type='text' name='user_input' value='<?php echo($user_input) ?>'> <input type='submit' name='submit' value='go'> </form> <body> </html> hope this helps
        nicko
At 05:10 9/07/01 -0700, you wrote:
I have a form that requires a user to enter various information (name, address, phone number, etc...). When they submit this form, the next PHP page checks to make sure that the required fields were filled in. What I would like to do is check to see if the required fields are all filled in and if they are not, save the values they submitted and go back to the original page, display a message that says the fields that need to be filled in and populate the rest of the fields with the information the user orignally submitted. This will keep them from having to type in all of the information again. I can run the checks just fine to see if the required fields are all filled in. I then save the data from all the fields into variables. What I would like to do is automatically forward the user back to the original page with the values (i already have all of the fields set with "value="$variablename"" to allow them to get the data that is sent back). The only way I have been able to get this to work is to set this up as a regular form with hidden HTML fields and a Submit button. I really want this to be an automatic process. Any thoughts on how to accomplish this? When I set up a "Header", the user is forwarded back to the page that I want, but none of the variables go with them (they are set by simply putting something like "$savedlastname = $lastname, where $lastname is the HTML variable from the original form). Any help is appreciated. -- 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
Documenta - Multimedia and Electronic Publishing Services **************************************************************************** The information contained in this e-mail is confidential and is intended solely for the addressee. If you received this e-mail by mistake please promptly inform us by reply e-mail or by telephoning + 61 2 9358 6199 and then delete the e-mail and destroy any printed copy. You must not disclose or use in any way the information in the e-mail. ****************************************************************************

« previous php.general (#57047) next »