LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Enterprise (https://www.linuxquestions.org/questions/linux-enterprise-47/)
-   -   CGI executed 2 times when form is posted (https://www.linuxquestions.org/questions/linux-enterprise-47/cgi-executed-2-times-when-form-is-posted-491587/)

lhought 10-11-2006 06:19 PM

CGI executed 2 times when form is posted
 
I have a CGI that executes properly on Red Hat 8.0 using Apache 2.0.40.
However, that same CGI on Red Hat Enterprise executes twice each time the form is submitted. I have tried 2 different versions of Apache with no difference. The CGI is written in C and call the execl() function. When I check the Apache access_log, it shows that the CGI was called two times in rapid succession. I added some code to capture the process ID of the parent and write that to a file called /tmp/test[ppid] where ppid is the parent process ID. There are always 2 files with different process ID created.
Anyone had a similar issue? I am almost convinced that it is not an Apache issue, but rather something that is happening at the Operating System level.

petersum 10-12-2006 04:25 PM

What "form" is probably the important question. Is it a standard HTML form? Or are you using some sort of JavaScript verify and submit process? As an experienced webmaster, I must recommend a javascript submit system, otherwise mouse button bounce on a "Submit" button plays havoc.
Who is submitting the form? You, or other persons?
Give some more details.

lhought 10-13-2006 07:21 AM

Your instincts were correct. I had already set up javascript to do form verification and submission, but I used "onsubmit return function(this)" and had a return value of true at the end of the function, even though I submitted the form within the function. I changed the return value to false, and the problem was solved. I am not sure why I did not encounter an error on my other servers.


All times are GMT -5. The time now is 03:54 AM.