如果我选择一顿饭,价格不在文本框中。我想要的是,如果我在选择框中选择 texbox 自动填充价格的选项。
<!DOCTYPE html>
<?php
include ("connection.php");
?>
<html>
<head>
<link rel="stylesheet" type="text/css" href="test.css">
<meta charset="utf-8">
<title>Kantine</title>
</head>
<body>
<div id="container">
<div id="logo"></div>
<div id="header">
<h1> Change or Delete meals</h1>
</div>
<div id="menu"></div>
<div id="content">
<?php
echo '<select name="Meals">';
$result = mysqli_query($con,"SELECT meal, price FROM meals") ;
while($row = $result->fetch_assoc())
{
echo "<option value=\""."\">" . $row['meal']."</option>\n";
echo "<br />";
}
echo '</select>';
echo '<input type="text" value="' . $row['price'] . '"/>';
mysqli_close($con);
?>
</div>
<div id="footer"></div>
</div>
</body>
</html>