如何使用PHP在html中使用SELECT标记查询我的SQL数据库

Basically I'd like to use the choices which the user has selected from a different select tags, and in essence store these as variables which I can then use to query my database in SQL.

My HTML code is here:

<div id ="search_elements">

    <img  src="UniSelect.jpeg">

    <select>
        <option selected disabled>Select a university</option>
        <option value="ucl">UCL</option>
        <option value="kings">Kings College</option>
        <option value="imperial">Imperial College</option>
        <option value="lse">London School of Economics</option>
    </select>

    <img  src="PriceSelect.jpeg">

    <select>
        <option selected disabled>Select a weekly rent price</option>
        <option value="50">0-£50</option>
        <option value="100"> £100-£150</option>
        <option value="150">£150-200</option>
        <option value="200"> £200+</option>
    </select>
</div>

And the type of php i would be looking to use would be:

//$con=mysqli_connect("localhost","adam","YjM3ZTYwOTQ5OWRmYWZh","adam_...");
//if (mysqli_connect_errno())
//  {
//     echo "Failed to connect to MySQL: " . mysqli_connect_error();
//  }

// Perform queries 
//$sql=mysqli_query($con,"SELECT CONTENT FROM Blog WHERE ID = 01");
//$result=mysqli_fetch_assoc($sql);

//echo $result['CONTENT'];
//mysqli_close($con);

To make it clear once more, I want to use the different values which the user selects, upon clicking a search button, have these query results shown in a table.

This solution a little differs from yours because you have no provided your form, submit button, etc. but in general, after a few changes, it should work too:

<form method="post" action="">
    <img src="UniSelect.jpeg">

    <select name="university">
        <option selected disabled>Select a university</option>
        <option value="ucl">UCL</option>
        <option value="kings">Kings College</option>
        <option value="imperial">Imperial College</option>
        <option value="lse">London School of Economics</option>
    </select>

    <img src="PriceSelect.jpeg">

    <select name="rent_price">
        <option selected disabled>Select a weekly rent price</option>
        <option value="50">0-£50</option>
        <option value="100"> £100-£150</option>
        <option value="150">£150-200</option>
        <option value="200"> £200+</option>
    </select>

    <input type="submit" value="Submit form">
</form>

And now, to get values of these (something like this and I recommend to place it above your form):

if (!empty($_POST)) {
    // Checking connection in here

    $university_id = mysqli_real_escape_string($con, $_POST['university']);
    $rent_price = mysqli_real_escape_string($con, $_POST['rent_price']);

    $sql = mysqli_query($con, "SELECT * FROM university WHERE name = '".$university_id."'");
    $result = mysqli_fetch_assoc($sql);
    // Same thing goes for rent price
}