Forums / General Questions / Form action posting back to tpl_checkout_success

Form action posting back to tpl_checkout_success

Locked

Views: 2,363

Results 1 to 5 of 5
This thread is locked. New replies are disabled.
19 Aug 2008, 12:17 AM
#1
glennnz avatar

glennnz

New Zenner

Join Date:
May 2008
Location:
New Zealand
Posts:
32
Plugin Contributions:
0

Form action posting back to tpl_checkout_success

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

$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

21 Aug 2008, 5:14 AM
#2
glennnz avatar

glennnz

New Zenner

Join Date:
May 2008
Location:
New Zealand
Posts:
32
Plugin Contributions:
0

Re: Form action posting back to tpl_checkout_success

Is there anybody out there.......

Can anybody help me with this?

Thanks

Glenn
:lookaroun

21 Aug 2008, 2:40 PM
#3
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Form action posting back to tpl_checkout_success

I don't know enough about forms to know whether $_SERVER['PHP_SELF'] is the right thing to use in that spot, but you can at least make the code a bit cleaner by using nested single and double quotes instead of ".```php
echo '<form method="post" action="' .$_SERVER['PHP_SELF']. '">';

21 Aug 2008, 9:09 PM
#4
glennnz avatar

glennnz

New Zenner

Join Date:
May 2008
Location:
New Zealand
Posts:
32
Plugin Contributions:
0

Re: Form action posting back to tpl_checkout_success

Thanks gjh42, I'll clean that up.

My core problem still exists though, can anyone help please?!?!?!?!

Thanks

G
:frusty:

26 Aug 2008, 7:34 PM
#5
glennnz avatar

glennnz

New Zenner

Join Date:
May 2008
Location:
New Zealand
Posts:
32
Plugin Contributions:
0

Re: Form action posting back to tpl_checkout_success

I have a solution to all of my questions re this, and have developed a working software license code generator.

At the moment it is just amendments to some of the pages, I've not developed it as a module.

It is for a very specific purpose, so may not be useful to anyone else, but if you're interested drop me a line.

Glenn