0

Hi All

I would be greatfull if somebody could help me out with this one. ive been scratching my head all day in trying to find a solution. I have a order confirmation page which displays the entire order on a shopping cart. this page inserts a row into table tblorders of all the info about the order, before thte user is then re directed to the paypal page. The problem is: every time the page is refreshed it inserts a new row, or if the user clicks the back page then re directs to the orderconfirm page again it inserts a new row. I was wondering if anybody out there had a solution for this?

PLEASE HELP!!!!

2
Contributors
8
Replies
12
Views
5 Years
Discussion Span
Last Post by mhaselip
0

refreshing causing a duplicate entry points to the fact that you're processing form data in the same page as the form itself. You should send form data to a separate file by using the action attribute in the form tag.

You can always redirect back to the form page from the handler page by using header().

You won't notice the skip back and forth, but refresh (or back button) no longer causes the problem.

Edited by diafol: n/a

0

hi, thanks 4 the response so quickly. there is a couple of issues. the sql query is not in a form, and just executes when the form is loaded. 2nd the form on orderconfirm.php is a form specifically designed for paypal as per paypal instructions, to send to the paypal server. is there a way to use cookies? say for example when the user 1st loads the page, set a cookie with a value of 1. incriment the cookie by 1 at the bottom of the page. put the sql code in an if statement testing if the cookie value is greater than 1 dont execute the sql insert query? not too sure if this would work. i did experiment but couldnt get it to work? any ideas?

0

ops, sorry, typo error 1st line, executes when the page is loaded not form

0

Well, it suggests that there is form handling going on that isn't triggered properly. A form on a page may trigger isset($_POST[..]) on page load.

0

could i use cookie value and increment it by 1 everytime the page is loaded, then use an if statement to check if the value of cookie is less than 1, execute the insert query? could that be away around it?

0

the thing is im not posting anything to this page. only posting the paypal form to paypal servers?

0

Can you post the code? otherwise I'm just guessing. Strip out the keys and ids though. We don't want your info.

0

sure i will post it tomorrow. thanks 4 your support so far :o)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.