Hi all i just learn php & trying to create a updating form, but the form textbox show up a <? echo $last; ?> inside the textbox…which is not what i want, i wan it to retrieve the value from the database… below is my code, i have highlight the html form code.
any help would be great
<?php
$id=$_GET[‘id’];
$username=“hamu”;
$password=“password”;
$database=“db_local”;
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( “Unable to select database”);
$query=" SELECT * FROM contacts WHERE id=’$id’";
$result=mysql_query($query) or die(mysql_error());
$num=mysql_numrows($result);
mysql_close();
$i=0;
while($i<$num){
$first=mysql_result($result,$i,“first”);
$last=mysql_result($result,$i,“last”);
$email=mysql_result($result,$i,“email”);
?>
**
<html>
<body>
<form action=“updated.php” method=“post” action=“update.php”>
<input type=“hidden” name=“ud_id” value="<?php echo $id; ?>">
First Name: <input type=“text” name=“ud_first” value=’"<? echo $first; ?>"’ /><br>
Last Name: <input type=“text” name=“ud_last” value="<? echo $last; ?>"><br>
<input name=“email” type=“text” id=“email” value="<? echo $email; ?>"/>
<input type=“submit”>
</form>
</html>**
<?php
$i++;
}
?>