how to send mail with multiple value of checkbox using php



<head><title>Send Mail</title></head>


<form name=”f1″ method=”post” action=”Send.php”>

<input type=”checkbox” name=”chk[]“   value=’One’>One  <br/>

<input type=”checkbox” name=”chk[]“   value=’Two’>Two

<input name=”" type=”submit” value=”Submit”  />








<head><title>Send Mail</title></head>



if($_REQUEST['chk'] == true){ // If one of the checkboxes checked
foreach($_REQUEST['chk'] as $value){
$chk.= “, “.$value;
$chk= substr($chk,2); // To remove “, ” from the beginning of the  variable

$subject = “Send mail using php” ;

$to= “Type here receiver mail id”;

$msg.= “<table width=’500′ border=’0′ align=’center’ cellpadding=’0′ cellspacing=’0′ style=’font-family:Arial, Helvetica, sans-serif; font-size:10pt; border:1px solid #ccc;’> “;

$msg.= “<tr>”;

$msg.= “<td height=’25′ bgcolor=’#F5F5F5′>&nbsp;</td>”;

$msg.= “<td height=’25′ bgcolor=’#F5F5F5′><b>Your Interest</b></td>”;

$msg.= “<td height=’25′ bgcolor=’#F5F5F5′><strong>:</strong></td>”;

$msg.= “<td height=’25′ bgcolor=’#F5F5F5′>$chk</td>”;

$msg.= “</tr>”;

$msg.= “</table>”;

$headers = “From: $email< Type here sender mail id >.”;

$headers .= “\r\nContent-Type: text/html; charset=ISO-8859-1\r\n”;

mail($to, $subject, $msg, $headers) ;

echo “<center><div align=’center’>”;

echo “<h1 style=’font-family:arial, verdana; font-size:15pt;’>Your mail has been sent successfully!</h1>”;

echo “  <br /> “;











About the Author