So I need to get information out of sql and put it in my dropdown in my form. Here's what I have... I'm very lost.. The info has been prepopulated into sql. I believe the top part is relatively right and then I don't know how to reference it in the form.
PHP
<?php
$id= $_GET['id'];
$conn = mysql_connect("localhost", "root", "") or die (mysql_error());
mysql_select_db("assignment 3", $conn);
$sql = "select schoolname FROM schooltable WHERE id=$id";
$result=mysql_query($sql, $conn) or die(mysql_error());
while ($row=mysql_fetch_assoc($result)){
foreach($row as $name => $value){
print "$name = $value</br>";
}
}
mysql_data_seek($result, 0);
while ($row=mysql_fetch_assoc($result)){
//select id, firstname, lastname from userlist
$school = $row["schoolname"];
$grad = $row["lastname"];
}
?>
HTML
<div class="form-group">
<label class='col-xs-4 control-label'>What school did you go to for your undergrad? </label>
<div class='col-xs-8'>
<select class="form-control background" id='dropdown'>
<option>"<?php print $schoolname ?>"</option>
<option>"<?php print $schoolname ?>"</option>
<option>"<?php print $schoolname ?>"</option>
<option>"<?php print $schoolname ?>"</option>
<option value="bing">"<?php print $schoolname ?>"</option>
</select>
<input type="hidden" name="id" id='id' value="<?php print $id ?>">
<input type="hidden" name="editMode" value="edit">
</div>
</div