needsomehelp
11-19-2012, 02:18 PM
For some reason no matter how many times I look at the code and make small changes here and there I am still unable to get the boxes to show their correct check or not. The checked boxes are correct when first shown. But if I was to submit the form and forget to confirm by entering my password in another field then the form is shown again with the previously check or not checked boxes. But it always reverts back to what is held in the 'sessions' which is got from the DB when they login.
The echo statements are showing the correct results but the if statements are not working correctly and showing the previously checked or not checked boxes.
What can I possibly be missing here ?
<? echo("<br><br>pmn '".$pmn."'<br><br>mfmn '".$mfmn."'<br><br>ofmn '".$ofmn."'<br><br>micn '".$micn."'<br><br>oicn '".$oicn."'<br><br>"); ?>
<? echo("<br><br>pmn '".$_POST['pmn']."'<br><br>mfmn '".$_POST['mfmn']."'<br><br>ofmn '".$_POST['ofmn']."'<br><br>micn '".$_POST['micn']."'<br><br>oicn '".$_POST['oicn']."'<br><br>"); ?>
<div class="field"> Accept server notification emails for: </div>
<div class="value"> <input name="pmn" value="checked" type="checkbox"<? if(isset($_POST['pmn'])) { if ($pmn == "checked") { echo(" checked=\"checked\""); } } else { if ($_SESSION['user']['pmn'] == 1) { echo(" checked=\"\""); } } ?>> Private Messages </div>
<div class="value"> <input name="mfmn" value="checked" type="checkbox"<? if(isset($_POST['mfmn'])) { if ($mfmn == "checked") { echo(" checked=\"checked\""); } } else { if ($_SESSION['user']['mfmn'] == 1) { echo(" checked=\"\""); } } ?>> Forum Messages (that I started) </div>
<div class="value"> <input name="ofmn" value="checked" type="checkbox"<? if(isset($_POST['ofmn'])) { if ($ofmn == "checked") { echo(" checked=\"checked\""); } } else { if ($_SESSION['user']['ofmn'] == 1) { echo(" checked=\"\""); } } ?>> Forum Messages (other posts where I contributed) </div>
<div class="value"> <input name="micn" value="checked" type="checkbox"<? if(isset($_POST['micn'])) { if ($micn == "checked") { echo(" checked=\"checked\""); } } else { if ($_SESSION['user']['micn'] == 1) { echo(" checked=\"\""); } } ?>> Item Comments (my items) </div>
<div class="value"> <input name="oicn" value="checked" type="checkbox"<? if(isset($_POST['oicn'])) { if ($oicn == "checked") { echo(" checked=\"checked\""); } } else { if ($_SESSION['user']['oicn'] == 1) { echo(" checked=\"\""); } } ?>> Item Comments (other items I contributed) </div>
The echo statements are showing the correct results but the if statements are not working correctly and showing the previously checked or not checked boxes.
What can I possibly be missing here ?
<? echo("<br><br>pmn '".$pmn."'<br><br>mfmn '".$mfmn."'<br><br>ofmn '".$ofmn."'<br><br>micn '".$micn."'<br><br>oicn '".$oicn."'<br><br>"); ?>
<? echo("<br><br>pmn '".$_POST['pmn']."'<br><br>mfmn '".$_POST['mfmn']."'<br><br>ofmn '".$_POST['ofmn']."'<br><br>micn '".$_POST['micn']."'<br><br>oicn '".$_POST['oicn']."'<br><br>"); ?>
<div class="field"> Accept server notification emails for: </div>
<div class="value"> <input name="pmn" value="checked" type="checkbox"<? if(isset($_POST['pmn'])) { if ($pmn == "checked") { echo(" checked=\"checked\""); } } else { if ($_SESSION['user']['pmn'] == 1) { echo(" checked=\"\""); } } ?>> Private Messages </div>
<div class="value"> <input name="mfmn" value="checked" type="checkbox"<? if(isset($_POST['mfmn'])) { if ($mfmn == "checked") { echo(" checked=\"checked\""); } } else { if ($_SESSION['user']['mfmn'] == 1) { echo(" checked=\"\""); } } ?>> Forum Messages (that I started) </div>
<div class="value"> <input name="ofmn" value="checked" type="checkbox"<? if(isset($_POST['ofmn'])) { if ($ofmn == "checked") { echo(" checked=\"checked\""); } } else { if ($_SESSION['user']['ofmn'] == 1) { echo(" checked=\"\""); } } ?>> Forum Messages (other posts where I contributed) </div>
<div class="value"> <input name="micn" value="checked" type="checkbox"<? if(isset($_POST['micn'])) { if ($micn == "checked") { echo(" checked=\"checked\""); } } else { if ($_SESSION['user']['micn'] == 1) { echo(" checked=\"\""); } } ?>> Item Comments (my items) </div>
<div class="value"> <input name="oicn" value="checked" type="checkbox"<? if(isset($_POST['oicn'])) { if ($oicn == "checked") { echo(" checked=\"checked\""); } } else { if ($_SESSION['user']['oicn'] == 1) { echo(" checked=\"\""); } } ?>> Item Comments (other items I contributed) </div>