The name of the ceckboxes is "sendInvoice[]" - so yes, I do get all the values.
Scenario:
sendInvoice[0] value="23001"
sendInvoice[1] value="23002"
sendInvoice[2] value="23003"
sendInvoice[3] value="23004"
now, the foreach($_POST[sendInvoice] as $fieldValue) loops through all four values.
But the $result only stores the LAST row. The data that matches the value "23004".
I need $result to store 4 rows, not just the last one.
Any suggestions anyone?
Here's some of the code:
<form name="processInvoices" action="send_faktura.php" " method="post">';
<td class="ListingsBd"> <input name="sendInvoice[]" type="checkbox" value="'.$row["invoiceID"].'" /> </td>
</form>
The send_faktura.php code:
<?php
session_start();
header("Cache-control: private"); // IE6 fix
include_once('config.php');
include (DIR_INCLUDE.'basicHeader.inc.php');
include ('functions.php');
include (DIR_INCLUDE.'initDB.php');
echo ('outside<br>'); // For testing purpose
foreach($_POST[sendInvoice] as $fieldValue)
{
$result = mysql_query('
SELECT
org.orgID, org.orgName, org.addStreetName, org.addPostNumber, org.addPostName,
inv.invoiceID, inv.orgID
FROM organization org, invoice inv
WHERE inv.invoiceID = "'.$fieldValue.'"
AND org.orgID = inv.orgID');
}
while ($row = mysql_fetch_array($result)) // For testing purpose
{
echo $row["orgName"].'<br>';
}
echo ('</head>
</html>');
?>