[eluser]Tom Glover[/eluser]
I have a clients website, in which I need it to write a form from and array.
In the view file:
Code:
<select name="relayletter2" id="relayletter">
<? if (is_array($letters)){
foreach ($letters as $letter)
{
if($letter === $selected)
{?>
<option selected="selected" value="<?=$letter?>"><?=$letter?></option>
<? }else{ ?>
<option value="<?=$letter?>"><?=$letter?></option>
<? }
}
}?>
</select>
The array that is passed to it:
Code:
$letters = array('a','b','c','d','e','...')
It is meant to compare that to what it is getting for the database, and when it finds a match it is meant to set the option selected.
At the Moment all options are selected.