Re: Keeping form fields populated

From: Date: Thu, 15 May 2003 20:14:13 +0000
Subject: Re: Keeping form fields populated
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-147785@lists.php.net to get a copy of this message
<select name="whatever"> <option value="1" <?php if($_POST['whatever'] == '1') echo 'selected'; ?>>Option 1</option> <option value="2" <?php if($_POST['whatever'] == '2') echo 'selected'; ?>>Option 2</option> </select> On Thu, 2003-05-15 at 16:15, Brian V Bonini wrote: > On Thu, 2003-05-15 at 14:28, Steve Keller wrote: > > At 5/15/2003 02:15 PM, Brian V Bonini wrote: > > > > > Is there a way to keep form fields populated after a user submits a form > > > via straight HTML or do I need to do this with PHP. > > > > What do you mean "via straight HTML" ? You have to feed it back to the > > browser somehow. You can just echo the posted values in your forms. > > > > <input type="text" name="myVariable" value="<? echo > > $_POST['myVariable']; ?>"> > > I see what your saying but how would you handle say a group of radio > buttons and reselecting what was previously selected? -- Adam Voigt (adam@cryptocomm.com) Linux/Unix Network Administrator The Cryptocomm Group

« previous php.general (#147785) next »