i have a problem with editing and updating my data on my database.
i cant pass or echo the data from the database into text boxes.
heres the php script.
// this script is for displaying the information oof the logged in member. and contains the link to edit the displayed info.
<?php
$result = mysql_query("select * from info where idnum = ".$_SESSION['valid'],$conn);
echo "</br><b>Profile Info:</b><br/>";
echo "<center><table width='50%' top=500px left=300 border=1>";
echo "<tr bgcolor='#CCCCCC'><td>Name</td><td>Surname</td><td>Email</td></tr>";
while($row = mysql_fetch_assoc($result))
{
$name = $row['name'];
$surname = $row['surname'];
$email = $row['email'];
echo "<tr><td>$name</td><td>$surname</td><td>$email</td></tr>";
}
echo "</table>";
echo "</br>";
echo "<td><a href=\"edit.php?idnum=$row[idnum]\">Edit Information</a>";
?>
//this script is supposedly for retrieving the info of the logged in user into textboxes. but it doesnt quite work.
<?php
$id = $_GET['idnum'];
$result1=mysql_query("select * from info where idnum=$id",$conn);
while($res=mysql_fetch_array($result1))
{
$name = $res['name'];
$surname = $res['surname'];
$email = $res['email'];
}
?>
<html>
<title>Edit Data</title>
<body>
<br/><br/>
<form name="form1" method="POST" action="edit.php">
<table border="0">
<tr>
<td>Name</td>
<td>
<input type="text" name="name" value=<?php echo $name;?>> </td>
</tr>
<tr>
<td>surname</td>
<td>
<input type="text" name="surname" value=<?php echo $surname;?>> </td>
</tr>
<tr>
<td>Email</td>
<td>
<input type="text" name="email" value=<?php echo $email;?>> </td>
</tr>
<tr>
<td><input type="hidden" name="id" value=<?php echo $_GET['idnum'];?>> </td>
<td><input type="submit" name="update" value="Update"></td>
</tr>
</table>
</form>