I'm trying to populate a select box with rows from a table, but it's not showing up properly. I've looked at the source of the page, and it looks like the option html is not being outputted. Anyone spot what's wrong?
<h1>Upload Picture</h1>
<form action="gallery.php" method="post">
<label for="photo">Select file: </label><input type="file" name="photo" />
<select name="photoGallery">
<?php
$sql="SELECT * FROM tblgallery ORDER BY galleryId";
$result=mysql_query($sql);
$row=mysql_fetch_array($result);
while($row = mysql_fetch_array($result))
{
print '<option value="'.$row['galleryId'].'">'.$row['name'].'</option>';
}
?>
</select>
<input type="submit" value="Upload photo"/>
</form>
Cheers,