I had a problem with your PHP code running or executing seemingly twice. To debug this phenomenon, I put some write-to-file code at the beginning of the script. Surprisingly, whenever I loaded my script in the browser, the file would be written to twice despite my one page load.
The problem was that The page I was developing had an <img> in it with the “src” attribute set blank. When the document was fully loaded, javascript was in place to dynamically assign the “src”. This worked perfectly fine in the pre-server-side-logic stage of development so it was an easy decision to begin debugging server-side logic.
The double execute happens when Firefox sees <img src=”" />. Not knowing what source to assign, it sends a request (the second request) to the current path (again) for the image. Therein lies the problem. It’s interesting to note that Firefox is not to blame, as it’s following HTML specification.




