DeanWhitehouse Posted April 23, 2008 Share Posted April 23, 2008 with this code } if(isset($_POST['hideemail']) == 0) { mysql_query("UPDATE $user SET show_email = '0' WHERE user_id = '$user_id'")or die('Could not change settings: ' . mysql_error()); } elseif(isset($_POST['hideemail']) == 1) { mysql_query("UPDATE $user SET show_email = '1' WHERE user_id = '$user_id'")or die('Could not change settings: ' . mysql_error()); } echo "Settings Saved"; } its changing the show_email even when i don't tick either box, it shouldn't be doing this, it should only do this if it is ticked. Quote Link to comment Share on other sites More sharing options...
Northern Flame Posted April 23, 2008 Share Posted April 23, 2008 if(isset($_POST['hideemail']) == 0) that line makes no sense. try: } if(empty($_POST['hideemail'])) { mysql_query("UPDATE $user SET show_email = '0' WHERE user_id = '$user_id'")or die('Could not change settings: ' . mysql_error()); } else { mysql_query("UPDATE $user SET show_email = '1' WHERE user_id = '$user_id'")or die('Could not change settings: ' . mysql_error()); } echo "Settings Saved"; } Quote Link to comment Share on other sites More sharing options...
DeanWhitehouse Posted April 23, 2008 Author Share Posted April 23, 2008 it still changes it Quote Link to comment Share on other sites More sharing options...
Northern Flame Posted April 23, 2008 Share Posted April 23, 2008 oh you dont want it to change anything? try this then: } if(!empty($_POST['hideemail'])) { mysql_query("UPDATE $user SET show_email = '1' WHERE user_id = '$user_id'")or die('Could not change settings: ' . mysql_error()); } echo "Settings Saved"; } Quote Link to comment Share on other sites More sharing options...
DeanWhitehouse Posted April 23, 2008 Author Share Posted April 23, 2008 i still have the same problem Quote Link to comment Share on other sites More sharing options...
DarkWater Posted April 23, 2008 Share Posted April 23, 2008 } if((isset($_POST['hideemail'])) && ($_POST['hideemail'] == 0)) { mysql_query("UPDATE $user SET show_email = '0' WHERE user_id = '$user_id'")or die('Could not change settings: ' . mysql_error()); echo "Settings Saved"; } elseif((isset($_POST['hideemail'])) && ($_POST['hideemail'] == 1)) { mysql_query("UPDATE $user SET show_email = '1' WHERE user_id = '$user_id'")or die('Could not change settings: ' . mysql_error()); echo "Settings Saved"; } else { echo "Invalid hide email value."; } } Quote Link to comment Share on other sites More sharing options...
DeanWhitehouse Posted April 23, 2008 Author Share Posted April 23, 2008 solved Quote Link to comment Share on other sites More sharing options...
DarkWater Posted April 23, 2008 Share Posted April 23, 2008 My suggestion worked? Quote Link to comment Share on other sites More sharing options...
DeanWhitehouse Posted April 23, 2008 Author Share Posted April 23, 2008 yer it did, Quote Link to comment 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.