I goofed in my code. I guess I was tired and not thinking correctly.
I 'm trying to have multiple chckboxes on a page that when checked will print the values out on the next page (I'm still debugging, I'll make it pretty later).
The problem is that I set up the script so that it only prints the last one checked, and I'm trying to figure out how to slavage without rewriting that part of the script.
###index.php###
echo "<form action='/pdf.php' method='post'>";
while(!$rs->EOF)
{
$invoice = $rs->fields["invoice"];
print "
<input type='hidden' value=$invoice name='invoice'>
<input type='image' src='pdf.png'>
<input type='checkbox' value='$invoice' name='checkbox'>
<strong>Client Name</strong> ".$rs->fields["company_name"]." (<strong>invoice#</strong>: ".$rs->fields["invoice"]. " (<strong>Bill Date</strong>: ".$rs->fields["bill_date"].")<br>
";
$rs->moveNext();
}
echo "</form>";
###pdf.php###
<?
require_once('FPDF/fpdf.php');
if (isset($POST['invoice'])){
print "$invoice<br>";
if (isset($POST["checkbox"])){
print "$checkbox<br>";
}
}else{
print "it wasn't set";
}
###example###
let say the index page displayed
1
2
3
4
and I checked 1 and 2 and clicked the button
The following screen would display
4
2
Which makes sense because the first thing that pdf.php says is print $invoice which was overwritten each time through, and the second thing is print $checkbox which prints the last box checked because it too was overwritten each time through.
For some reason this code made sense when I wrote it but when it failed I could see why.
Any ideas on how to fix this?