On my site, a user gets email notifications when someone comments on their profile, or comments on their blog etc...I have made a email settings page that has checkboxes to allow the user to decide to receive emails or not.
This is what I am wrapping around the email notification code chunck for the pages that have the php mail:
<?php if(isset($_POST['email_toggle']) && $_POST['email_toggle'] == 'true') { if(isset($_POST['commentProfileSubmit']) && $auth) {
$query etc
$to = etc
}
}
My question is what do I put on the email settings script that has the actual check boxes to make them stay checked or unchecked once you submit your settings? Another words what do I put in the if(isset portion to implement the changes?
if(isset($_POST['email_toggle']) && $_POST['email_toggle'] == 'true') {
/* what do I put here? */
header("Location: Profile.php?id=" . $auth->id);
mysql_query($query,$connection);
/* input/check boxes and submit button */
<tr>
<td class="email_check">
<input type="checkbox" name="email_toggle" value="true" checked="checked" /> Receive email Notifications When Someone Answers A Question You've Answered
</td>
</tr>
<tr>
<td>
<input style="margin:10px 0px 0px 10px;" class="submit" type="submit" name="email_toggle" value="Save Settings" />
</td>
</tr>
}