Hello I have a strange problem in which my If statement is not working. I am doing a simple user registration and would like to check if the variable 'sendmail' is equal to 1, to send an e-mail if not to not send e-mail. I have shorten the mail function code for better understanding:
$usr->storeFormValues( $_POST );
/* check if the password is the same */
if( $_POST['password'] == $_POST['conpassword'] && $_POST['email'] == $_POST['emailconfirm'] ) {
/* Check if the sendmail variable is equal to 1 */
if ($POST['sendmail'] == 1){
/* send e-mail function the */
mail($to,$email_subject,nl2br($email_body),$headers);
}
echo $usr->register($_POST);
So the problem is that the condition in this case if ($POST['sendmail'] == 1)
is not working, and it is not sending the e-mail. In case if I write it like this if ($POST['sendmail'] = 1)
this way is working no matter what argument the variable sendmail have inside it, it is always sending the e-mail.
this is from where sendmail
is coming
<select name="sendmail">
<option value="0">No</option>
<option value="1">Yes</option>
</select>
I've checked the post array and the variable sendmail is inside so this can't be the problem. Any help will be very welcome. Thank you.