So I have a very odd error. I have a value, $ll1_name, that is derived from a MySQL query, through PHP.
Here is the example code:
$sql = mysql_query("SELECT data_txt FROM field_data WHERE itemid = $uid AND fieldid = 16");
$row = mysql_fetch_array($sql);
$ll1_key = $row[0];
//$ll1 = $row[0];
$sql = mysql_query("SELECT info FROM landlords WHERE key = '$ll1_key'");
$row = mysql_fetch_array($sql);
$ll1_name = $row[0];
^ that sets the variables to the correct landlords, if they exist for a certain tenant.
<select name=ll1>
<?php
if (is_null($ll1_key)){
?>
<option selected> Empty </option>
<?php
}
else{
?>
<option selected value="<?php echo "$ll1_key"; ?>"> <?php echo "$ll1_name"; ?> </option>
<?php
}
while ($curLandlord = mysql_fetch_array($landlordRows)){
?>
<option value="<?php echo "$curLandlord[0]"; ?>"> <?php echo "$curLandlord[1]"; ?></option>
<?php
}
?>
</select>
^That populates the drop down. If it is null, it defaults to "Empty". Otherwise, it will make the selected option the current land lord.
However, the field is blank. The page source looks like this:
<option selected value="ll1_72"> </option>
You can see the correct key for the landlord is set as the value; but my php code outputs nothing for the selected text in the field. HOWEVER, if you refresh the page, it loads properly with the land lord's name. But the source code looks exactly the same. If I refresh firefox without cached data (ctrl+shift+r), then I still get a blank field after refreshing.
Does anyone have any idea what is going on? I see this behavior across multiple browsers (IE 11, Chrome, and Firefox).