我的服务页面中有两个下拉/选择输入,一个是服务类型,另一个是每个服务的价格,每个服务都是从 mysql 发送的如何使价格的值自动更改为连接到的任何数据服务类型需要什么例如选择,写一本书它会从数据库中显示它的价格
当我用 jquery 尝试它时,我不能给出任何选项值,因为它都来自 db
<label style="margin-left:20px; padding: 0 20px;
margin-bottom: 39px;">what we do for you </label><select name="topic" Required="Required">
<?php
// Make the connection:
$connection = mysqli_connect ('localhost', '#', '#', '#');
// If no connection could be made, trigger an error:
if ($connection->connect_error)
{
die("Database selection failed: " . $connection->connect_error);
}
# Set encoding to match PHP script encoding.
mysqli_set_charset($connection, 'utf8');
$query = "SELECT * FROM services";
$select_service = mysql_query($query);
while ($row = @mysql_fetch_assoc($select_service)) {
echo "<option value=\"".$row['id']."\">".$row['title']."</option>\n ";
}
?>
</select><br>
<label style=" margin-left: 136px;
margin-bottom: 30px; padding: 0 20px;">price</label><select disabled name="topic" Required="Required">
<?php
// Make the connection:
$connection = mysqli_connect ('localhost', '#', '#', '#');
// If no connection could be made, trigger an error:
if ($connection->connect_error)
{
die("Database selection failed: " . $connection->connect_error);
}
# Set encoding to match PHP script encoding.
mysqli_set_charset($connection, 'utf8');
$query = "SELECT * FROM services";
$select_service = mysql_query($query);
while ($row = @mysql_fetch_assoc($select_service)) {
$service_prise = $row['prise'];
$service_content = $row['description'];
echo "<option >".$row['description']."</option>\n ";
}
?>
</select>
<br>
暮色呼如