Page 1 of 1

select problem

Posted: Wed Jul 03, 2002 9:56 am
by prasadharischandra
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

Posted: Wed Jul 03, 2002 10:06 am
by RandomEngy
Try this instead:

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>
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.

Re: select problem

Posted: Wed Jul 03, 2002 10:21 am
by prasadharischandra
thank u it's working