Hi all
I am trying to create an array from a generate list. i.e. I am asking a DB to show me every product it has against Company X
Using a checkbox I want to choose a number of products and add a volume and cost. Therefore when I submit I want to recod in an array 3 numbers. All my reading on the subject only shows 2, and being new to this I am struggling to get my head around multdimensional arrays.
while ($row = mysql_fetch_array($result1))
{
extract ($row);
echo "<tr> <td> <input type='checkbox' name='interest[$APref]' value='$APref'> $APref\n </td><td> $APname </td><td> <input type='text' name='volume[$APref]' > </td><td> <input type='text' name='cost[$APref]' > </td></tr>\n";
}
echo "</table>\n";
The following text is what I use for getting 2 items across in the area. Above I added in a text box which I called 'cost[$APref]
But what do I add below to show it. OR am I completly wrong.
foreach ( $_POST['volume'] as $field => $value)
{
$query1 = "SELECT * FROM ALIPROD WHERE APref=$field";
$result1 = mysql_query($query1) or die ("Couldn't get the ASLISUP list");
$row1 = mysql_fetch_array($result1);
extract ($row1);
if (isset( $_POST['interest'][$field]))
echo"<tr><td>$field</td><td>$nrowin</td><td>$value </td><td>$APname </td></tr>";
}
Thanks