I am just trying to make a php edit script using a combo box or any other method. But I am not sure how to write a script when selecting a sportsid and fetch the related data at the same time.
$sql = "SELECT * FROM sports WHERE sport_id=2";
$query = mysql_query($sql);
while ($row = mysql_fetch_array($query)){
$id = $row['sportid'];
$sname = $row['sport_name'];
$sprice = $row['sport_price'];
}
mysql_free_result($query);
?>
<html>
<head>
<title>Edit User Info</title>
</head>
<body>
<form action="updateinfo.php" method="post">
userid:<br/>
<input type="text" value="<?php echo $id;?>" name="id" >
<br/>
Last Name:<br/>
<input type="text" value="<?php echo $sname;?>" name="sname"/>
<br/>
Last Name:<br/>
<input type="text" value="<?php echo $sprice;?>" name="sprice"/>
<br/>
<br/>
<input type="submit" value="submit changes"/>
</form>
</body>
</html>