in reply to Re: Weird CGI behaviour on different Browsers - Apache
in thread Weird CGI behaviour on different Browsers - Apache

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.

Replies are listed 'Best First'.
Re^3: Weird CGI behaviour on different Browsers - Apache
by Anonymous Monk on Aug 04, 2015 at 12:25 UTC
    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.

        Yes, it's a possibility that your script is executing twice. You said in the OP "the exit is getting ignored" - that is such an unlikely bug that it's practically impossible. So you need to keep track of the state to detect and prevent multiple executions of the script.

        Perhaps it's time to develop a test case that reproduces the problem, like a few really short CGI scripts that redirect to each other, similar to what your code is doing now. Post it here so we can help you debug, otherwise we're left guessing and all the debugging is up to you.