3

Edit for solution:

I still don't know why it's doing the double entry, but for the time being I've done some hacks.

I added a UID token to the form, generated an MD5 and stored it with the DB entry. The script does a check to see if entry already exists or not. If it does, it passes off the entry ID, if not it adds a new one, then passes off the ID for final confirmation message.

The form was doubling even the UID luckily, so I was able to catch it doing that. If it was two different UID's, then I may have had problems, haha.

I'd like points goto PeeHaa, because if anyone else finds this question, I want other people to also know that Post, Redirect and Get is a good coding practice. (Post to your inserting script, redirect away from the page to a confirmation page, and use GET to get values to show).

Previous content:

OK, this is pretty basic.

I know it's been asked a bazillion times here already, but none of the existing questions are pertinent to my problem.

Basic HTML form. No fancy jQuery or anything.

<form id="attendee_confirm" class="regform" method="post" action="http://url.com/wip/events/register/?">
<input name="attendee[0][first_name]" value="Bruce">  
<input name="attendee[0][last_name]" value="Wayne">


<input type="hidden" name="reg_form" value="true">
<input type="hidden" name="questions" value="true">
<input type="hidden" name="action" value="done_confirming">
<input type="hidden" name="event_id" value="1">

<input type="submit" name="mySubmit" id="mySubmit" value="Confirmed"> 
<input type="button" value=" &lt;-- BACK " onclick="history.go(-1);return false;">

</form>

WHY is my form posting it's data twice?? I really don't understand this.

This is a confirmation form. A user is brought here after filling out the first form, just to confirm the names.

The first form works fine, and brings over the appropriate information. The second one is supposed to confirm and send the email/process.

The form posts twice, and I only ever see the output from the 2nd attempt. I cannot get any output from the first one.

Because of this, if I try adding Session Token "catches" to the form to try and catch duplicate entries, the first try is allowed through, but the user only sees the second catch.

Is this perhaps a server problem? My server is running ModSecure (Which has been pissing me off lately), and I'm really frustrated. I'm getting double occupancy for my events when I shouldn't...

Edit info:

This happens on all browsers, so it is not browser specific.

I've also tried setting the capture script to redirect after receiving information to process, but as I mentioned, the data is being sent by some invisible thing first, and the output seen by the user is actually the second data. Not the first set. Everything is still doubled. Owf..

The server logs were a bust. It's happening in one post. I'm going to double check scripts that might run twice.....

GC_Cryss
  • 31
  • 3
  • Page refresh without [PRG](http://en.wikipedia.org/wiki/Post/Redirect/Get)? – PeeHaa Sep 06 '12 at 15:43
  • Which browser are you using and what add-ons do you have installed? – Lee Sep 06 '12 at 15:45
  • PeeHaa> I thought of this as well, but there is no refresh going on. Not manual, at least. There is also no code on the page for refreshing. So unless the click is somehow causing a refresh and re-click, I don't think so. The post is sent to the server where the Action is picked up. It then outputs different content based on the action. If I attempt the 'Redirect after post' it won't work. The first post is lost, and only the 2nd one is shown. – GC_Cryss Sep 06 '12 at 15:59
  • Lee> This occurs on all browsers. FireFox, IE7/8 and Chrome. This is not a browser issue. I saw a lot of issues with specific browsers, but this one is all of the browsers. – GC_Cryss Sep 06 '12 at 16:00

3 Answers3

0

Your ACTION parameter looks a little funky. Why is there a question mark at the end of it? Your method is POST but your ACTION url implies that the method is GET.

Jack Albright
  • 509
  • 3
  • 11
  • Nope... It doesn't appear to have any influence. Removing the question mark still has the double posting.. Argh. Thanks for the suggestion, though. – GC_Cryss Sep 06 '12 at 16:11
  • i wonder if the problem is on the page that the form's ACTION points to (http://url.com/wip/events/register/). Can you post that code? – Jack Albright Sep 07 '12 at 17:18
0

I still don't know why it's doing the double entry, but for the time being I've done some hacks.

I added a UID token to the form, generated an MD5 and stored it with the DB entry. The script does a check to see if entry already exists or not. If it does, it passes off the entry ID, if not it adds a new one, then passes off the ID for final confirmation message.

The form was doubling even the UID luckily, so I was able to catch it doing that. If it was two different UID's, then I may have had problems, haha.

I'd like points goto PeeHaa, because if anyone else finds this question, I want other people to also know that Post, Redirect and Get is a good coding practice. (Post to your inserting script, redirect away from the page to a confirmation page, and use GET to get values to show).

GC_Cryss
  • 31
  • 3
0

I have find this problem more than once and I have feeling, that this problem is more rule than exception. Anybody can correct if they think that I am wrong and create good explanation why this is error in html code, because I haven't find errors in my code all these years.