FORUMS


The Form Tools forums are no longer active, but the old posts have been archived here. Please see the Help page on how to get help / report issues.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Successive form submissions by the same user overwrite eachother
#1
Brick 
Apologies if this has already been discussed. I couldn't find anything in the forum.

The problem I am having is that successive form submissions by the same user overwrite eachother.

I am using Formtools v2.0.5 (API) for collecting competition entries. I am using the PayPal IPN thing too, so the form submission doesn't get finalised until PayPal has reported back

The form is at: http://ac-ca.org/pay/index.php

It works fine for single competition entries but some people seem to want to enter themselves, then another person and possibly a third person. The first entry is currently overwritten in the formtools database by the subsequent entry.

From the user's perspective everything seems to go swimmingly until they notice they have been emailed back with the same entry number several times.

It is important that each entry is given the correct and unique Formtools submission ID and that every paid up entry is finalised in Formtools.

Any pointers on how to tackle this would be great.

Thanks
Rry
Reply
#2
Hi Rry,

There are definitely some nuances when using Paypal (especially when you're using Paypal IPN).

Have you reviewed the documentation for Paypal yet: http://docs.formtools.org/tutorials/paypal/?page=index

It sounds like you're using the email (since the users continues to receive other emails with the same ID) to uniquely identify the submissoin, so if the user uses the same email for each entry the record is overwritten. You may need some additional information to uniquely identify the record or simply query the email to see if its in the database to prevent the same email from submitting more than once.

Hope this helps.

Cheers,

Joe
Reply
#3
Hi Joe,

Thanks a lot for your reply. I have had a look through documentation again and found this, which refers to resetting form sessions to allow for resubmission:
http://docs.formtools.org/api/?page=ft_a...m_sessions

I already had this PHP in my 'Thank you' page:
PHP Code:
<?php
$curr_folder 
dirname(__FILE__);
require_once(
"$curr_folder/includes/library.php");
$fields ft_api_init_form_page($pp["form_id"]);
ft_api_clear_form_sessions();
?>
So that seems to be OK.

The submission ID gets sent to PayPal in the 'custom' variable to uniquely identify the transaction at that end:
PHP Code:
$fields["custom"] = $fields["form_tools_submission_id"]; 

Once the PayPal IPN script has finalised the form submission:
PHP Code:
// successful payment! finalize the submission in the database
if (eregi("VERIFIED"$result)) 
{
  
ft_finalize_submission($pp["form_id"], $_POST['custom']);


the submission ID just gets sent out in the FT triggered email labelled 'Entry number'.

If anyone has any further ideas on this that would be great.

Thanks
Rry



(Jul 26th, 2011, 4:37 PM)Joe Wrote: Hi Rry,

There are definitely some nuances when using Paypal (especially when you're using Paypal IPN).

Have you reviewed the documentation for Paypal yet: http://docs.formtools.org/tutorials/paypal/?page=index

It sounds like you're using the email (since the users continues to receive other emails with the same ID) to uniquely identify the submissoin, so if the user uses the same email for each entry the record is overwritten. You may need some additional information to uniquely identify the record or simply query the email to see if its in the database to prevent the same email from submitting more than once.

Hope this helps.

Cheers,

Joe

Reply
#4
Hi Rry,

Hmm! First off, yes the ft_api_clear_form_sessions() function is definitely necessary to clean the slate after a successful submission. But from what you described, it doesn't sound like it's doing its job... if they clicked back to the form the previous submission ID simply shouldn't be in memory any longer to be passed along to PayPal. Strange!

Try this: on your first form page, after the ft_api_init_form_page call, add the following line. That will always output the contents of the current session - including whatever submission ID Form Tools thinks it has.

PHP Code:
print_r($fields); 

Then, put through a submission (in PayPal sandbox mode is best, of course), and try
(a) returning to the form page by clicking on a link to the page, or manually entering the URL in your browser and
(b) returning to the form page by navigating to the page via the "Back" button in your browser.

Take a look at what's outputted in each case.

Let me know how it goes!

- Ben
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)