What is wrong with this.
I am trying to put SELECTED FOR THE select option.
It is erroring on
if ($strSid == $mySid) {
echo "SELECTED";
}
Can anyone tell me what I am doing wrong.
<?php
$sql = "select * from tbl_status";
$result = mysql_query($sql)
or die("INvalid query: " . mysql_ERROR());
while ($row = mysql_fetch_array($result)){
$mySid = $row['s_id'] ;
echo '<option value="' . $row['s_id'] . '" ' . if ($strSid == $mySid) {
echo "SELECTED";
} . '>' . ucwords($row['desc']) . "</option>\r\n";
}
?>
I am trying to put SELECTED FOR THE select option.
It is erroring on
if ($strSid == $mySid) {
echo "SELECTED";
}
Can anyone tell me what I am doing wrong.
<?php
$sql = "select * from tbl_status";
$result = mysql_query($sql)
or die("INvalid query: " . mysql_ERROR());
while ($row = mysql_fetch_array($result)){
$mySid = $row['s_id'] ;
echo '<option value="' . $row['s_id'] . '" ' . if ($strSid == $mySid) {
echo "SELECTED";
} . '>' . ucwords($row['desc']) . "</option>\r\n";
}
?>