PHP简单发票收据

i want to make a simple receipt from a fast food JollyMenu.php

<form action="showReceipt.php" method="POST">
<table >
<tr><td>Transaction ID <input type="text" name="txtID"> <?php echo date("m / d / Y");?></td></tr>
<tr><td><h2>Your Order:</h2></td></tr>
<tr><td><input  type="checkbox"  name="cbItem[]" value="Chicken Joy"> Chicken Joy (PhP 90.00)</td> <td>Quantity <input type="text" name="txtQty[]"></td></tr>
<tr><td><input  type="checkbox" name="cbItem[]" value="Jolly Spaghetti"> Jolly Spaghetti (PhP 50.00)</td> <td>Quantity <input type="text" name="txtQty[]"></td></tr>
<tr><td><input type="checkbox" name="cbItem[]" value="Yum Burger"> Yum Burger (PhP 29.00)</td> <td>Quantity <input type="text" name="txtQty[]"></td></tr>
<tr><td><input type="checkbox" name="cbItem[]" value="Jolly Twirls"> Jolly Twirls (PhP 25.00)</td> <td>Quantity <input type="text" name="txtQty[]"></td></tr>
<tr><td><input type="checkbox" name="cbItem[]" value="Big Champ"> Big Champ (PhP 120.00)</td> <td>Quantity <input type="text" name="txtQty[]"></td></tr>
<tr><td>Amount Given: <input type="text" name="txtAmount"></td> <td><input type="submit" name="btnGen" value="Generate Receipt">  <input type="reset" value="Clear">


</table>
</form>

ShowReceipt.php

<html>
<body>


<?php
        
error_reporting(0); 
echo '<p align="center">JollyBee Food Corporation</br>
        1/F Kalentong cor. Shaw Blvd. Mandaluyong City 550</br>
            </br></p></br>';

$item=$_POST['cbItem'];
$qty=$_POST['txtQty'];
    
if(isset($_POST['btnGen'])){        
{
    
foreach($item as $selected)
{   
            
    if($selected=='Chicken Joy')
    {
        $price = 90.00;
        $total += 90.00;
        
    }
    else if($selected=='Jolly Spaghetti')
    {
        $price = 50.00;
$total += 90.00;
        
    }
    else if($selected=='Yum Burger')
    {
        $price = 29.00;
        $total += 29.00;
    }
    else if($selected=='Jolly Twirls')
    {
        $price = 25.00;
        $total += 25.00;
    }
    else if($selected =='Big Champ')
    {
        $price = 120.00;
        $total += 120.00;
    }
                    
echo $selected.$_POST["txtQty"][$i].'<br>';
echo $price.'<br>';
    
}
}
}


echo $total;
                                                
?>

</body>
</html>

and I need to get also need to get the value of the textboxes for quantity to multiply to the number of items has been choose..how can I get the value of textboxes to run in that for each loop.?

</div>

I would recommend using unique product ids for each item and qty field. The problem is that the cbItem and txtQty keys will only match up correctly when ALL items are checked. The quickest/easiest solution as I see it would be to key each txtQty field name on the associated cbItem VALUE. So the FIRST

<input type="text" name="txtQty[]">

would become:

<input type="text" name="txtQty[Chicken Joy]">

Then in your PHP code, replace each set of:

$price = 90.00;
$total += 90.00;

with:

$price = 90;
$total += ($price * max($qty[$selected], 1)); // ensure at least qty of 1