in reply to Weird CGI behaviour on different Browsers - Apache

Multiple inserts of the same value should probably be a huge red flag: sounds like you're not keeping track of your state properly, so you should start doing that - are you using some kind of web framework, or plain vanilla CGI? Why do you need to bounce the user around between different scripts anyway, why can't you handle what "success.pl" and "error.pl" do in the same script?

  • Comment on Re: Weird CGI behaviour on different Browsers - Apache

Replies are listed 'Best First'.
Re^2: Weird CGI behaviour on different Browsers - Apache
by Yaerox (Scribe) on Aug 04, 2015 at 12:22 UTC
    What do you think and mean by saying "Multiple inserts of the same value"? I wanna make sure we're talking about the same thing. In my script, I only do the INSERT if the script doesn't stop after redirecting in my if-clause. Basically there are no multiple inserts...

    No frameworks, just perl and cgi. With perl I also print some javascript, and I do this always like this: print qq{<!--My HTML HERE-->};.

    Why do I need to bounce the user around? Well I got a HTML-Form, and if I send the form something needs to get done in the background. So do I have a choice in not doing this?
    Update: I just missed to say, that if it is successfully, I need to show him the created order notice. The user is also able to look other already created ones, so I have one script always having the same function. Same for error.pl, I'm always redirecting to error.pl using different parameters to print different errors. For me this makes it a little bit cleaner on developing and maintaining.
    Thank you sir.
      What do you think and mean by saying "Multiple inserts of the same value"?

      You said in the OP:

      ... another third weird way the script runs sometimes is, that the line is getting inserted 2 times ...

      Which I took to mean that the INSERT is executed twice and you end up with two rows in the DB with the same value(s)...?

        That's the weird point. I do only have one single execution in my script. There is no loop, just a single INSERT-Execution wirtten in my script. That's why I came to the thoughts of a redirection loop - which I didn't found yet.