lovephp Posted March 14, 2016 Share Posted March 14, 2016 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); } Quote Link to comment Share on other sites More sharing options...
Solution lovephp Posted March 14, 2016 Author Solution Share Posted March 14, 2016 ok never mind found a solution which is $room = nl2br(implode(',', $_POST['room'])); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.