I have weird problem. I need to select option in input select. This is my code:
<?php
$val = 'box=Box|billboard=Billboard|insert=Insert|skyscrapper=Skyscrapper';
foreach ($val as $val) {
$val=explode("=", $val);
if ($selected==$val[0]) {
echo '<option value="',stripslashes($val[0]),'" selected="selected">',stripslashes($val[1]),'</option>';
} else {
echo '<option value="',stripslashes($val[0]),'">',stripslashes($val[1]),'</option>';
}
}
?>
This script select me all of options - every option has selected="selected". Even when I print values it is like if (0==box) which should returns false but it returns true. What is going on?
Aucun commentaire:
Enregistrer un commentaire