Hello,
Kindly check this code. It is working however it seems very long. I was hoping if this can be optimize. I also wish to remove the ctr variable so I can add many value in array without counting them.
[php]Shift
- Select -
<?php
$ctr2=0;
$time1=array (“1st Shift”,“2nd Shift”,“3rd Shift”);
while($ctr2<=2) {
if($time1[$ctr2] == $_POST[‘ftime’]) {
echo “$time1[$ctr2]\n\t\t\t”;
} else {
echo “$time1[$ctr2]\n\t\t\t”;
}
$ctr2++;
}
?>
[/php]
I read on some website that foreach command can be use.
Is that possible here?
Thanks in advance.