psquillace Posted October 22, 2007 Share Posted October 22, 2007 Hello All: Currently on a site I have a checkbox for people to check to opt-in to ok to send them emails if checked with // Check for Opt-In. if (!isset($_POST['optin']) && ((empty($_POST['email'])) || !valid_string($_POST['email']))) { $optin = FALSE; $email = FALSE; $canspam = TRUE; } else { if (isset($_POST['optin']) && (!empty($_POST['email']))) { if (check_email_address($_POST['email']) && ($_POST['optin'] == 'TRUE')) { $optin = $_POST['optin']; $email = $_POST['email']; $canspam = TRUE; } else { $message .= 'To receive emails, you need to check the box and provide a valid email address!<br>'; } } else { $message .= 'To receive emails, you need to check the box and provide a valid email address!<br>'; } } However, I would like it to say NO when someone does not check the box. How would I add that in here? thanks for any advice, Paul Link to comment https://forums.phpfreaks.com/topic/74343-solved-if-else-to-say-something-other-than-true/ Share on other sites More sharing options...
Wes1890 Posted October 22, 2007 Share Posted October 22, 2007 just set it as a variable if ( !isset($_POST['optin']) ) { $optin = "No"; } and check it with if ( $optin == "No" ) Link to comment https://forums.phpfreaks.com/topic/74343-solved-if-else-to-say-something-other-than-true/#findComment-375633 Share on other sites More sharing options...
psquillace Posted October 22, 2007 Author Share Posted October 22, 2007 WHOOO HOOO! Thanks for your help, that worked great! Paul Link to comment https://forums.phpfreaks.com/topic/74343-solved-if-else-to-say-something-other-than-true/#findComment-375655 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.