Q695 Posted July 9, 2009 Share Posted July 9, 2009 the menu code: <?php if ($u_row[char_mnu]=1){ echo " <a href='?page=menus&contract=char_mnu&type=charicter'>Character</a> <br> working "; } else if($u_row[char_mnu]=0){ echo " <a href='?page=menus&expand=char_mnu&type=charicter'>Character</a> "; } ?> operating code: <?php $expand=$_GET[expand]; $contract=$_GET[contract]; if($expand){ $sql="UPDATE players SET $expand = '1' WHERE id='$id' ;"; } if($contract){ $sql="UPDATE players SET $contract = '0' WHERE id='$id' ;"; } echo $sql; ?> <form name='wipe' method='get'> <input type='hidden' name='page' value="<?php echo $_GET[type] ;?>">//page address info </form> <script> document.wipe.submit(); </script> The bug is a logic issue, but I don't know what I'm doing wrong. Link to comment https://forums.phpfreaks.com/topic/165310-toggle-menu-help-logic-problem/ Share on other sites More sharing options...
Bendude14 Posted July 9, 2009 Share Posted July 9, 2009 What is happeming? and what were you expecting? Link to comment https://forums.phpfreaks.com/topic/165310-toggle-menu-help-logic-problem/#findComment-871791 Share on other sites More sharing options...
Q695 Posted July 9, 2009 Author Share Posted July 9, 2009 it's staying expanded, and should be able to shrink to one line. Link to comment https://forums.phpfreaks.com/topic/165310-toggle-menu-help-logic-problem/#findComment-871792 Share on other sites More sharing options...
Q695 Posted July 9, 2009 Author Share Posted July 9, 2009 think of a start menu that doesn't automatically close on it's own. Link to comment https://forums.phpfreaks.com/topic/165310-toggle-menu-help-logic-problem/#findComment-871799 Share on other sites More sharing options...
Q695 Posted July 9, 2009 Author Share Posted July 9, 2009 Does anyone see what I'm doing wrong? Link to comment https://forums.phpfreaks.com/topic/165310-toggle-menu-help-logic-problem/#findComment-872112 Share on other sites More sharing options...
haku Posted July 9, 2009 Share Posted July 9, 2009 if ($u_row[char_mnu]=1){ This will always be true. Echo out $u_row[char_mnu] after this line of code. Link to comment https://forums.phpfreaks.com/topic/165310-toggle-menu-help-logic-problem/#findComment-872114 Share on other sites More sharing options...
Q695 Posted July 9, 2009 Author Share Posted July 9, 2009 Why won't it ever be 0 again? Link to comment https://forums.phpfreaks.com/topic/165310-toggle-menu-help-logic-problem/#findComment-872135 Share on other sites More sharing options...
J.Daniels Posted July 9, 2009 Share Posted July 9, 2009 if ($u_row[char_mnu]=1){ and else if($u_row[char_mnu]=0){ are assigning values, which will always return true (which is why haku wanted to you echo them out) They need to be changed to: if ($u_row[char_mnu]==1){ and else if($u_row[char_mnu]==0){ Link to comment https://forums.phpfreaks.com/topic/165310-toggle-menu-help-logic-problem/#findComment-872141 Share on other sites More sharing options...
Q695 Posted July 9, 2009 Author Share Posted July 9, 2009 it's been a while since I've dealt with PHP , that should help Link to comment https://forums.phpfreaks.com/topic/165310-toggle-menu-help-logic-problem/#findComment-872150 Share on other sites More sharing options...
Q695 Posted July 9, 2009 Author Share Posted July 9, 2009 I also just noticed that I forgot to call the statement Link to comment https://forums.phpfreaks.com/topic/165310-toggle-menu-help-logic-problem/#findComment-872174 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.