Hi there!
I tried finding my answer by searching through posts, so far no luck, so I’m hoping anyone of you can help me out on this one. At the moment I’m working on a invoice page, before you can invoice you need an order, but each invoice you make may contain multiple orders.
What I’ve got, A while loop that shows all non invoiced orders with a checkbox in front of it. When you check multiple checkboxes it first has to check if the customer ID (klant_id) is the same, you can’t raise 1 invoice for 2 different customers. So far my script can tell me if I selected 2 different customers or 2 the same.
The problem is, when I for example select the 2nd or 3rd checkbox it won’t show me which order ID or customer ID I selected, only if I select the 1st checkbox.
Thank you in advance.
[code=php]
if(!empty($_POST[‘action’]))
{
$value = ’empty’;
$i = 1;
while(isset($_POST[‘klant_id’.$i]))
{
if($value == “empty”)
{
$value = $_POST[‘klant_id’.$i];
}
if($_POST[‘klant_id’.$i] != $value )
{
die(“<br><br>It is not possbile to raise an invoice for different customers.”);
}
echo “Customer ID: ” . $_POST[‘klant_id’.$i] . ” Order ID: ” . $_POST[‘order_id’.$i] . “<br>”;
$i++;
}
echo “<br><br>SUCCES!!<br>”;
}
?>
[CODE]
[COLOR=”red”]$i = 1;
while($dbinfo = mysql_fetch_assoc($res)) { [/COLOR]
<input type=”checkbox” name=”klant_id[COLOR=”Red”]<?=$i;?>[/COLOR]” value=”[COLOR=”red”]<?=$dbinfo[‘klant_id’];?>[/COLOR]” />
<input type=”hidden” name=”order_id<[COLOR=”red”]?=$i;?>[/COLOR]” value=”[COLOR=”red”]<?=$dbinfo[‘order_id’]?>[/COLOR]”>
[COLOR=”Red”]<?php $i++; }?>[/COLOR]