RE: [PHP] Automatic form initialization in PHP

From: Date: Wed, 10 Oct 2001 10:43:43 +0000
Subject: RE: [PHP] Automatic form initialization in PHP
Groups: php.general 
Request: Send a blank email to php-general+get-70619@lists.php.net to get a copy of this message
hopefully this'll give you some ideas... you get the data from the database into variables, then you can code your HTML form like <input type="text" name="username" value="<? echo $username; ?>"> <br> <input type="text" name="phone" value="<? echo $phone; ?>"> if the user isn't logged in the form elements will be empty. etc etc etc you can reuse the same form for both registration and editing, by checking if, say, the person has logged in, then you can change some code for the form's action, like if ($user_has_logged_in) { $form_code = "<form method=\"post\" action=\"update_details.php\">"; } else { $form_code = "<form method=\"post\" action=\"new_user.php\">"; } in your HTML form you put at the start of the form <? echo $form_code; ?> (input elements) (submit and reset buttons) </form> hopefully that'll get you started cheers Dave -----Original Message----- From: ja [mailto:"ja"@pb1.pair.com, =?iso-8859-1?Q?=40tele=F1ecos=2Ecom=3E?=@pb1.pair.com] Sent: 10 October 2001 11:49 To: php-general@lists.php.net Subject: [PHP] Automatic form initialization in PHP Hi, Could someone give me a hint or pointer to a tutorial on how to do the following? I would like to set-up a web page to update the entries in a database of people. I´d like to reuse the submission form I use to register a new user where all the personal information is requested (telephone, office, name ,etc.). Assuming I have all the fields corresponding to the user whose info has to be updated, how should I pass this information to the submission form so that the (already registered) user only has to modify the information that has changed? I´m working with PHP. I would appreciate a pointer to an example code doing this. Cheers, Silvia -- 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 (#70619) next »