d401tq Posted July 15, 2008 Share Posted July 15, 2008 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. If you would like the code for the functions let me know. 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.txt. 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. 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. Link to comment https://forums.phpfreaks.com/topic/114933-form-section-being-run-twice/ Share on other sites More sharing options...
d401tq Posted July 15, 2008 Author Share Posted July 15, 2008 I can't seem to edit my post for some reason, so will clarify - it doesn't *look* like the if part is being run twice, in that a 'counter' variable shows only one increment, but it must be running twice as the function inside increments a database value by 1, and is showing an increase of 2. For completeness I include the 'included' php file as a txt here: www.dur.ac.uk/pool.league/database.txt Link to comment https://forums.phpfreaks.com/topic/114933-form-section-being-run-twice/#findComment-591126 Share on other sites More sharing options...
d401tq Posted July 16, 2008 Author Share Posted July 16, 2008 I have been since told about the .phps format. Thus: www.dur.ac.uk/pool.league/div1input.phps and www.dur.ac.uk/pool.league/database.phps Link to comment https://forums.phpfreaks.com/topic/114933-form-section-being-run-twice/#findComment-591704 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.