making drop down,radio sticky

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
rami
Forum Contributor
Posts: 217
Joined: Thu Sep 15, 2005 8:55 am

making drop down,radio sticky

Post by rami »

i am doing this to make text field sticky

Code: Select all

<td width="41%"><b>Enter name</b></td>
            <td width="59%"><input type="text" name="name" size="45" maxlength="45" value="<?php if (isset($_POST['category'])) echo $_POST['category']; ?>" /></td>
but i want my select ,drop down to be sticky as well
how can i do that

and whats about radio and check box


when submisssion is not done text fields get previous values but dropdown ,check box ,radio but loses it
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Dynamically add

Code: Select all

selected="selected"
and

Code: Select all

checked="checked"
for option and radio/checkbox tags respectively.
rami
Forum Contributor
Posts: 217
Joined: Thu Sep 15, 2005 8:55 am

Re:

Post by rami »

feyd wrote:Dynamically add

Code: Select all

selected="selected"
and

Code: Select all

checked="checked"
for option and radio/checkbox tags respectively.
not quite clear
what does it mean by dynamically any example on it
Attilitus
Forum Commoner
Posts: 27
Joined: Wed Aug 08, 2007 2:32 pm

Re: making drop down,radio sticky

Post by Attilitus »

i assume that you have code somewhere that loops through the bits while building the multiple form/checkboxes right? Very basically you want to put a unique variable within the form code for each of the checkboxes <input type=radio $form1_checked /> and then within the script detect whether or not that form ought to be checked. It is ought to be checked assign the variable $form1_checked the value checked="checked"
Post Reply