I
I am trying to customise my tpl_checkout_success_default.php to perform an action if a specific product has been purchased.
So far I have:
PHP Code:
<?php
$sql = "SELECT products_id, products_quantity from orders_products where orders_id = " . $zv_orders_id;
$result = $db->Execute($sql);
while(!$result->EOF) {
if ($result->fields['products_id'] == 192) {
$no_purchased = $result->fields['products_quantity'];
}
$result->MoveNext();
}
if (!isset($_POST['submit']))
{
$row_current = 1;
echo "<p><strong>Here is my Form</strong></p>";
echo "<form method=\"post\" action=\"" .$_SERVER['PHP_SELF']. "\">";
while ($row_current <= $no_purchased)
{
echo "<table>";
echo "<tr>";
echo "<td>Serial number " .$row_current.": </td>";
echo "<td><input type='text' name='serial".$row_current."'></td>";
echo "</tr>";
echo "</table>";
$row_current++;
}
echo "<br/>";
echo "<input type='image' src='includes/templates/sd/buttons/english/button_confirm_send.gif' name='submit'>";
echo "</form>";
echo "<br/><br/>";
}
else {
echo "the answer is '$serial1'";
}
?>
The form displays fine, but when I enter some data into the form and clcik 'submit', it returns to my product page. I think the problem is with the:
echo "<form method=\"post\" action=\"" .$_SERVER['PHP_SELF']. "\">";
line.
Can anyone help?
Thanks
G
Bookmarks