How to get/retrieve value from database MySQL which triggeres by select/option value my html and php code on picture attached
<select name="blok" id="blok">
<option value="B01">B01</option>
<option value="B02">B02</option>
<option value="B03">B03</option>
</select>
<?php
require_once 'connect.php';
$query = "SELECT brand FROM table WHERE blok = **(value from option)**";'
$result = $mysqli->query($query);'
$row = $result->fetch_array();'
echo $row[brand];
?>
you need to place your select
in a form as follows:
<form action="action.php" method="post">
<!-- your form in here -->
<p><input type="submit" /></p>
</form>
then access the data in the php script (in this case the file is called action.php) something like this:
$blok = htmlspecialchars($_POST['blok']); // escaping dodgy chars is a good idea, even if you use prepared statements as below.
then insert it into your query. Be aware though that you should be using prepared statements to insert your data into your query. Examples of which you can find here.
It seems that you are not storing the "value from option" in any variable. You should do that, and then insert it in the $query