i have two dropdown/select input in my services page one for the type of services and the other is the price of every services each is sent from mysql How do I make the value of the price change automatically to whatever data is connected to the the services type what is want For example selection ,writing a book it will show the price of it from db
when i try it with jquery i can't give any option value because it comes from db both
<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>