Hi all,
I am new to php, but not new to programming, just so you know how slowly to talk. I have recently inherited a website and learnt php to completely do it over.
Onto the problem.
The premise of the page is a form for submitting sports results. Firstly we check if they have submitted results (IF statement), if so, it processes them - at the moment I'm just inputting the result for the two teams into MySQL and also increasing the number of games played by two team members by 1. Secondly, if they haven't submitted results but have submitted the two teams (ELSEIF) then we give them the form to submit details for individual team members and the score. Thirdly, if they haven't chosen teams, they get a different form to do so.
The issue I am having is that the part after the IF statement is being run twice. I.e. the number of games played is being increased by two. I have checked that it is the code given below at fault and not the function being used. The game result is given using an INSERT MySQL query in the 'addres' function. The game result is not being duplicated, which is I assume due to it being overwritten (the entire IF loop is being run twice). The individual result is given using an UPDATE MySQL query in the 'addsinglesgames' function. A 'counter' variable within the IF section shows only 1 count, yet any action, e.g. doing something with the mysql database, is run twice.
I have given a link to the whole code, rather than pasting the whole lot and making a mess, or pasting not enough. It can be found at www.dur.ac.uk/pool.league/div1input.phps. The actual page is of course .....div1input.php although you will not be able to see the full functionality as to submit results one needs a password. If this needs to change to solve the problem I may resort to doing so. The code for the included functions is at www.dur.ac.uk/pool.league/database.phps.
If anyone can solve this problem I will be extremely grateful, as it is about the last thing that needs doing on the site, and is becoming very frustrating!
Thankyou in advance.