my code is
<select name="find" onChange="sub2()">
<option value="C">Confirmed</option>
<option value="R">Reserved</option>
<option value="A">Cancelld</option>
<option value="W">Waiting</option>
<?if ($find=='W'){
$test="<option value=\"W\" selected>Waiting</option>";
}?>
<?if ($find=='C'){
$test.="<option value=\"C\" selected>Confirmed</option>";
}?>
<?if ($find=='A'){
$test.="<option value=\"A\" selected>Cancelld</option>";
}?>
<?if ($find=='R'){
$test.="<option value=\"R\" selected>Reserved</option>";
}
echo $test;?>
</select>
my problem is if i select "cancelled" in same page it will appear "cancelled"
but in my code it will selected but two "cancelled" i want to only one cancelled and other shoul be in drop down
help me
select problem
Moderator: General Moderators
-
prasadharischandra
- Forum Commoner
- Posts: 57
- Joined: Thu May 09, 2002 2:19 am
- Location: sri lanka
- Contact:
- RandomEngy
- Forum Contributor
- Posts: 173
- Joined: Wed Jun 26, 2002 3:24 pm
- Contact:
Try this instead:
And get rid of the $test stuff. I'm guessing this is what you want, but I'm not sure what you're trying to say.
Code: Select all
<option value="C"<? if($find=='C') echo " selected" ?>>Confirmed</option>
<option value="R"<? if($find=='R') echo " selected" ?>>Reserved</option>
<option value="A"<? if($find=='A') echo " selected" ?>>Cancelld</option>
<option value="W"<? if($find=='W') echo " selected" ?>>Waiting</option>-
prasadharischandra
- Forum Commoner
- Posts: 57
- Joined: Thu May 09, 2002 2:19 am
- Location: sri lanka
- Contact:
Re: select problem
thank u it's working