Selected Days of the Week

Hello,
For edit,

This is working: $select = 4;
This array does not work: $select = array(3,4);

What is wrong?
[php]

<?php
$days_of_the_week = array(-1 => ‘*’, 0 => $lang[‘sunday’], $lang[‘monday’], $lang[‘tuesday’], $lang[‘wednesday’], $lang[‘thursday’], $lang[‘friday’], $lang[‘saturday’]);
$select = array(3,4,6);
foreach($days_of_the_week as $value=>$day_of_the_week)
{
$id = $value;
$selected = $id == $select ? ’ selected=“selected”’ : ‘’;
echo “<option value=”$id"$selected>$day_of_the_week\n";
}
?>

[/php]

Example output
[php]

*
Sunday
Monday
Tuesday
Wednesday
Thursday
Friday
Saturday

[/php]

Thank you

Problem ok,

$selected = in_array($id, $select) ? ’ selected=“selected”’ : ‘’;

Sponsor our Newsletter | Privacy Policy | Terms of Service