harlequeen Posted July 17, 2011 Share Posted July 17, 2011 Hi I have a league tables results entry page which is generated by calling the teams in a particular division into a form. In the form I have a checkbox as I want to enter the points scored then check the checkbox so that when I submit the results the checkbox is showing that a result has been posted and adds one to the total of games played. Some of the boxed don't get checked as I don't get the scores all at the same time. However, when I submit the form, the info in the database is adding 1 to the games played total, whether the checkbox is checked or not. <input type="checkbox" name='resultPosted[]' size="1" value="<? echo $row['resultPosted'];?>"></td> and I set the resultPosted variable to 'unchecked' at the beginning of the form and here is my if statement, setting the games played. If ($resultPosted="checked") { $played=$played+1; } else { $played=$played; } Any help would be appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/242186-checkbox/ Share on other sites More sharing options...
TeNDoLLA Posted July 17, 2011 Share Posted July 17, 2011 Dunno about anything else, but in your form you are assigning resultsPosted as array and then you are comparing it in your if like it would be a variable (it is array instead). Quote Link to comment https://forums.phpfreaks.com/topic/242186-checkbox/#findComment-1243711 Share on other sites More sharing options...
wildteen88 Posted July 17, 2011 Share Posted July 17, 2011 If ($resultPosted="checked") You should be using the comparison operator == not the assignment operator = in the above line Quote Link to comment https://forums.phpfreaks.com/topic/242186-checkbox/#findComment-1243712 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.