Re: Creating forms dynamically

From: Date: Wed, 15 Mar 2006 04:11:10 +0000
Subject: Re: Creating forms dynamically
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-231921@lists.php.net to get a copy of this message
Paul Goepfert wrote:
Hi all, I have been working on a page where I have a form. I currently have the form in an else block with no access to it if I need to redisplay the form incase of errors. To be more specific I want to redisplay the page with the errors displayed. I would like to have the form coded once. It would save on file size. In my form I have a table that holds the text inputs. I do have MySQL code for dropdown menus. If anyone has any ideas on how to create the form when the error messages are displayed without having to code it a second time please let me know.
function display_form($errormessage=false) { if ($errormessage) {
    echo "There was a problem!<br/>";
} // form goes here. } Works well and it's nice and easy to use. You can either pass in true/false for the $errormessage or pass in a message (which isn't displayed by default). -- Postgresql & php tutorials http://www.designmagick.com/

« previous php.general (#231921) next »