I have a column named categories and a column named rates in my products table each category has a different rate associated with it so if a user inputs data like in the below example:
Example: user input form
Auto Parts in category
Air Conditions in category
Bicycles in category
I need to search the table products for the fields where the above inputs match and find the associated rate for each input
and echo the rate for each
Auto Parts 60%
Air Conditons 45%
Bicycles 25%
html form snippet
[php]<?php
//connect to mysql database
$connection = mysqli_connect(“localhost”,“root”,"",“customs”) or die("Error " . mysqli_error($connection));
//fetch data from database
$sql = "select categories from lt_products";
$result = mysqli_query($connection, $sql) or die("Error " . mysqli_error($connection));
?>
<TD width="156"> <input name="pcategories[]" type="text" list="productcategories" class="input_field2" autocomplete="off" value="Description of Goods" id="pcategories" onfocus="clearText(this)" onblur="clearText(this)">
<datalist id="productcategories">
<?php while($row = mysqli_fetch_array($result, MYSQLI_ASSOC)){ ?>
<option value="<?php echo $row['categories']; ?>"><?php echo $row['categories']; ?></option>
<?php } ?>
</datalist>
<?php mysqli_close($connection); ?>
$pcategories=$_POST[‘pcategories’];[/php]
I’m stuck at this point