information going to next page
Posted: Sat Mar 21, 2009 5:25 am
have checkboxes relating to options drawn from a database:
as below
Problem is when the user clicks on a checkbox, and click to proceed tothe next page,
the information is not brought with them
they are already in a session which is continued on each page:
can any one tell me where i am going wrong?
This is the code on the product page
$f1 = $rS->Fields(0); //product code
$f2 = $rS->Fields(1); //price name
$f3 = $rS->Fields(2); //product price
$f4 = $rS->Fields(3);//my image column
$i =0;
while (!$rS->EOF )
{
echo "<tr><td align='center'>".$f2->value."</td>
<td align='center'> ".$f3->value."</td>
<td align='center'> <img src='../images/".$f4->value." '/></td>
<td align='center'><input type='checkbox' name='checkbox".$f1->value."'></td></tr>";
$rS->MoveNext();
$i++;
}
This is the code so far on the next page.
$rS = $conn->execute("SELECT * FROM goods");
$f1 = $rS->Fields(0); //product code
$f2 = $rS->Fields(1); //price name
$f3 = $rS->Fields(2); //product price
$f4 = $rS->Fields(3);//my image column
$i =0;
$name = $_POST['checkbox".$f1->value."'];
foreach ($_POST['checkbox'] as $name => $value)
{
echo '<input type="checkbox" checked="checked" name="checkbox".$f1->value."" value="'.$f1->value.'"/>'."\n";
}
as below
Problem is when the user clicks on a checkbox, and click to proceed tothe next page,
the information is not brought with them
they are already in a session which is continued on each page:
can any one tell me where i am going wrong?
This is the code on the product page
$f1 = $rS->Fields(0); //product code
$f2 = $rS->Fields(1); //price name
$f3 = $rS->Fields(2); //product price
$f4 = $rS->Fields(3);//my image column
$i =0;
while (!$rS->EOF )
{
echo "<tr><td align='center'>".$f2->value."</td>
<td align='center'> ".$f3->value."</td>
<td align='center'> <img src='../images/".$f4->value." '/></td>
<td align='center'><input type='checkbox' name='checkbox".$f1->value."'></td></tr>";
$rS->MoveNext();
$i++;
}
This is the code so far on the next page.
$rS = $conn->execute("SELECT * FROM goods");
$f1 = $rS->Fields(0); //product code
$f2 = $rS->Fields(1); //price name
$f3 = $rS->Fields(2); //product price
$f4 = $rS->Fields(3);//my image column
$i =0;
$name = $_POST['checkbox".$f1->value."'];
foreach ($_POST['checkbox'] as $name => $value)
{
echo '<input type="checkbox" checked="checked" name="checkbox".$f1->value."" value="'.$f1->value.'"/>'."\n";
}