<?php
//fetch.php
if(isset($_POST["actionp"]))
{
 //$connect = mysqli_connect("localhost", "root", "", "testing");
 include('includes/config.php');
 $output = '';

if($_POST["actionp"] == "product_name")
 {
  $query = "SELECT * FROM `materials` WHERE m_name= '".$_POST["query"]."'";
  $result = mysqli_query($con, $query);
  //$output .= '<option value="">Select Type</option>';
  while($row = mysqli_fetch_array($result))
  {
    //$output .= '<option value="">Select Name</option>';
   $output .= '<option value="'.$row["rate"].'">'.$row["rate"].'</option>';
  }
 }
 




 echo $output;
}
?>