Hi, can you help me this:
<?
$SQL1 = "SELECT * FROM krane, sort WHERE (krane.sort_id=sort.sort_id) and (kraanid=1)";
// Select 1 krane only from the database with id = 10
$Result1 = mysql_db_query ( $DB, $SQL1, $Connection );
if ($Row1 = mysql_fetch_array($Result1))
{ do {
?>
<select name="sort_id">
<option>Select a sort from the list</option>
<?
$SQL="select * from sort";
$Result=mysql_db_query( $DB, $SQL, $Connection);
while($myrow=mysql_fetch_array($Result))
{
echo "<option value='";
echo $myrow["sort_id"];
echo "' ";
if ($myrow["sort_id"]=$Row1["sort_id"]) { echo "selected"; }
// Check which sort has been stored in de database
// When the stored value of sort_id in table krane meets one of the id's stored
// in the table sort then print 'selected' so the value will be displayed
echo ">";
echo $myrow["sort"];
echo "</option>";
}
?>
</select>
<?
}
while($Row1 = mysql_fetch_array($Result1)); }
?>
BUT this is not working!!!
when I look in the source al values are selected.
And only the last value is being displayed
example:
<option value='1' selected>1</option>
<option value='2' selected>2</option>
<option value='3' selected>3</option>
<option value='4' selected>4</option>
SO how can I solve this?
Even with this equation doesn't work:
if ($myrow["sort_id"]="3") { echo "selected"; }
Any ideas?
Thanks in advance
Patrick