How to send the checkbox value to email
HTML of form is given below
?php
for($i=$start;$i $end ;++$i)
{
if($emails[$i]!=""){
$userId=$emails[$i]['ID'];
$user_info = get_users($userId);
echo"tr class='iedit alternate'
td class='name column-name' style='border:1px solid #DBDBDB;padding-left:13px;'input type='checkbox' id='haet_mail_test_address' name='ckboxs[]' value='".$emails[$i]['user_email']."'nbsp;".$emails[$i]['user_email']."/td";
echo "td class='name column-name' style='border:1px solid #DBDBDB;' ".$user_info-user_login."/td";
echo "/tr";
}
}
?
button class="button-primary" id="haet_mail_test_submit" name="submit" type="submit"Send Email/button
div id="haet_mail_test_sent" class="haet-mail-dialog" title="?php _e('Email sent','wp-html-mail'); ?"
p
?php _e('Your message has been sent.','wp-html-mail'); ?
/p
below my Javascript code
$('#haet_mail_test_submit').click(function(){
var checkbox = $('#haet_mail_test_address').val();
$.post(ajaxurl, { 'action':'haet_mail_send_test', 'checkbox':checkbox} , function(response) {
$( "#haet_mail_test_sent" ).dialog({
dialogClass: "no-close",
modal: true,
buttons: [
{
text: "OK",
click: function() {
$( this ).dialog( "close" );
}
}
]
});
});
});
AJAX function is given below
function send_test() {
$email= $_POST['checkbox'];
echo $email;
wp_mail( $email, ''.$email.'');
wp_die();
}
I am new on Wordpress so how I can send the checkbox values to wp_mail