Forum Moderators: coopster

Message Too Old, No Replies

PHP4.3: Sticky Forms question

How do u make radio buttons and check boxes "sticky"?

         

jd80

7:48 am on Feb 22, 2004 (gmt 0)

10+ Year Member



I understand how to make form fields "sticky" if they're text input but how do you make radio buttons and check boxes sticky? What I mean by "sticky" is that the field retains its value after being submitted if there is an error. So for example:

<form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post">
<input type="text" name="aName" value="<?php echo $_POST['aName'];?>"/>
<input type="submit"/>
</form>

...would cause the "aName" field to be sticky. But what about radio buttons, check boxes, select lists, etc.?

John

jatar_k

5:33 pm on Feb 22, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



<form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post"> 
<p><input type="text" name="aName" value="<?php echo $_POST['aName'];?>"/>
<p>1<input type="radio" name="arad" value="1"<? if ($_POST['arad'] == 1) echo " checked";?>>
<br>2 <input type="radio" name="arad" value="2"<? if ($_POST['arad'] == 2) echo " checked";?>>
<br>3 <input type="radio" name="arad" value="3"<? if ($_POST['arad'] == 3) echo " checked";?>>
<p><input type="submit"/>
</form>

jd80

6:00 pm on Feb 22, 2004 (gmt 0)

10+ Year Member



U the man jatar_K! Thanks!

John

(Are thank you's not appropriate for this forum or is it okay to thank others?)

jatar_k

6:02 pm on Feb 22, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



it's ok :)