I am updating an entry into my database on a specific page. I have a table for studies and a table for authors. The studies table just shows a number in a field to indicate the id or the author who wrote it.
When editing the number shows up for the author ($row[4]), but when I refresh the page, the name of the author shows up. I want the name to show up and not the number. How can I make the name show up the first time?
By the way, the dropdown itself populates the names.
Here is the code I have for this section.
Code in header
<?php
if(isset($_GET['edit']))
{
$id=$_GET['edit'];
$response=mysql_query("SELECT * FROM studies WHERE id='$id'");
$row=mysql_fetch_array($response);
}
?>
Code in the HTML body
<select name="new_estudo_author">
<option value="<? echo $row[4]?>"><?php echo $row[4]?>...</option>
<?
$authorlist=mysql_query("select * from authors order by name asc");
while($row_authorlist=mysql_fetch_assoc($authorlist)){
?>
<option value="<?echo $row_authorlist['id']?>"><?echo $row_authorlist['name'];?></option>
<?
}
?>
</select>