@Pheagey Sir , below is my code where i am send mail for each check box selected . I want same information to get store in db table You didn't select any Check Box.
\n"); } else { $N = count($hobb); echo("You selected $N Option(s): ");
include ('connect.php'); //connection setting for DB
include ('class.phpmailer.php'); //Php SMTP Mail class
for($i=0; $i < $N; $i++)
{
$var1=$hobb[$i];
echo $var1;
echo "
";
// Vaiable fetching from previous
$pieces = explode(";",$var1);
echo $pieces[0];//Message Id
echo "
";
echo $pieces[1]; //Employee ID
echo "
";
echo $pieces[2];// Employee Name
echo "
";
echo $pieces[3];// Employee Name
$msg_id = $pieces[0]; //mail id need to refer to mail table
$usr_name = $pieces[2]; // piece1
$usr_lname = $pieces[3]; // piece1
$usr_mailid = $pieces[4]; // piece1
switch ($msg_id)
{
case "1":
SQL Query to update for 1
break;
case "2":
SQL Query to update for 2
break;
case "3":
SQL Query to update for 3
break;
}
$tbl_name1="message_master"; //database table name
$table = "select * from tester.message_master where id_msg_master in($msg_id)"; //Query to fetch needed info from mail table
$recordset= mysql_query($table) or die(mysql_error()); // Execute Query on Mysql
while($row = mysql_fetch_array($recordset))
{
$to = $row['message_toid'];
$from = $row['message_fromid'];
$mail= new PHPMailer();
$mail->IsSMTP();
$mail->SMTPAuth = true;
//$mail->SMTPSecure = "ssl";
$mail->Host = "172.21.2.4";
$mail->Port = 25;
$mail->CharSet = "big5";
$mail->Subject = $row['message_subject'].$usr_name . $usr_lname;
$mail->SetFrom($from, 'First Last');
$mail->Username = "pavanjg@microland.com";
$mail->Password = "microland@bng1";
$mail->Body = $row['message_description'];
$mail->IsHTML(true);
$mail->AddAddress($to, "Admin");
if(!$mail->Send())
{
echo "Mailer Error: " . $mail->ErrorInfo;
}
}
}
echo "successfully uploaded!..";
}
}
else
{
echo "error please check ur code";
}