Hey all, my first post in this brilliant website, got a lot of ideas from here.
So I'm a student and currently we are learning a bit of php and right now I'm stuck.
I have a database with URL adresses, there is 3 fields, id, name and adress.
I have added 10 adresses in the database and I can show them on a website with no problem.
Now I want to show them in a combobox where they I can select any of the adresses, I have written some code but I dont think it can read from the database, the combobox is empty.
What am I doing wrong?
<select name="batch" onchange="submit();">
<option value="-1" >-- Select Adress --</option>
<?php
mysql_connect("localhost" , "root" , "");
mysql_select_db("persontb");
$sql="SELECT * FROM adresser ORDER BY namn ASC";
$result=log_mysql_query($sql);
while($item=mysql_fetch_assoc($result))
{
echo '<option value="'.$item['id'].'" '.isSelected($item['id'],$batch).'>'.$item['namn'].'</option>';
}
?>
</select>