I'm doing an AS2 form to an already existing site and I'm trying to pass the variables of a checkbox component to a PHP form and I'm not sure if I got things right. I only have one checkbox on stage so people can opt in and out of a mailing list. No label. Instance name is sender_optin. I have this code for my checkbox:
var optinSelected = false;
if (sender_optIn.selected) {
optinSelected = true;
}
else {
optinSelected = false;
}
// If the checkbox has been selected...
if(optinSelected)
{
// Send 1 for true
optin = 1;
}
else {
// and 0 for false
optin = 0;
}
And here's how the PHP is processing it:
Any idea where I'm screwing up?Code:<?php $sender_name = $_POST['name']; $sender_email = $_POST['email']; $sender_optIn = $_POST['optin']; if( $sender_name == true ) { $sender = $sender_email; /*********************************************************************/ //REPLACE THE EMAIL BELOW WITH YOUR OWN $recipient = "[email protected]"; /********************************************************************/ $email_body = " Name: $sender_name \r\n Opt In: $sender_optIn \r\n"; $extra = "From: $sender\r\n" . "Reply-To: $sender \r\n" . "X-Mailer: PHP/" . phpversion(); if( mail( $recipient, "A Replay for Whatever.com", $email_body, $extra ) ) { echo "success=yes"; } else { echo "success=no"; } } ?>


Reply With Quote
