I had tried to display the divided value of saleprice from the table (additem) and from the table (addbill) data .i.e.quantity that we entered in the addbill table and display the value in the price column in addbill table.
Previously I was done to fetch from one table data from other table data
if(isset($_POST['submit1'])){
$m = $_POST['itemname'];
$sp = "SELECT saleprice FROM additem WHERE itemname='$m'";
$q = mysqli_query($link,$sp);
$n = mysqli_fetch_assoc($q);
$saleprice = $n['saleprice'];
$sql = "INSERT INTO addbill (bill_id,itemname,quantity,price) VALUES
('".$_POST['billid']."','".$_POST['itemname']."','".$_POST['quantity']."','" .$saleprice."')";
$result = mysqli_query($link,$sql);
if ($result) {
header("Location:addbill.php");
}else{
echo "error during adding";
}
}