Jump to content

how to email checkbox values without multiple emails?


Go to solution Solved by lovephp,

Recommended Posts

ok so m stuck here not getting what to do, the email i want to sent it as

 

example

 

Dear Management,

 

          ABCD XYZ would like to book the following rooms

 

         Room No. 101

         Room No. 102

         Room No. 103

 

From: 2016-03-16  to: 2016-03-21

 

but with my code everything is looping and sending multiple emails, now to get foreach values inside the mail body without looping and send just one email with the number of room user selects from checkbox?

 

 

$room = $_POST['room'] = <input type="checkbox" name="room[]" value="<?php echo $roomid; ?>" /> <?php echo $roomname; ?>

 

if(isset($_POST['submit'])){

$room = $_POST['room'];
$checkin = trim($_POST['checkin']);
$checkout =trim($_POST['checkout']);
$name = trim($_POST['name']);
$phone = trim($_POST['phone']);
$email = trim($_POST['email']);

foreach($room as $rooms) {    
 $rval = 'Room No.: '.$rooms.'<br/>';
}


$headers = "From: Someone <someemail@somemail.com>\r\n";
$headers .= "Reply-To :$from\r\n";
$headers .= "Return-Path: someemail@somemail.com\r\n";   
$headers .= 'MIME-Version: 1.0' . "\n";
$headers .= 'MIME-Version: 1.0' . "\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'Content-type: text/html; charset=us-ascii' . "\r\n";
'X-Mailer: PHP/' . phpversion();

$message = " ";

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

}

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.