Email Sending with multiple body's ?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
gavinbsocom
Forum Commoner
Posts: 71
Joined: Tue Sep 30, 2003 9:51 pm

Email Sending with multiple body's ?

Post by gavinbsocom »

This is the second time im posting an email question an its the last. I wont to have multiple forms combined into one message so when someone clicks send it takes all the forms to my email.


Challenge.php

Code: Select all

<form method="post" action="mail.php"> 
TO : <input type="text" name="to" value="russian@bniclan.com">
SUBJECT : <input type="text" name="subject" value="">
Clan Name : <input type="text" name="msg1" value="">
Clan Tag : <input type="text" name="msg2" value="">
Leader Name : <input type="text" name="msg3" value="">
Time (eastern) : <input type="text" name="msg4" value="">
Server : <input type="text" name="msg5" value="">
Password : <input type="text" name="msg6" value="">
FROM : <input type="text" name="from" value="email@address">
<input type="submit" value="Send Email"> 
<input type="reset">
</form>
Mail.php

Code: Select all

<?php 

$complete = "Email Sent !"; 

if($sent) 
  &#123; 
  echo "$complete"; 
  &#125; 
    elseif($complete) 
    &#123; 
    header('location:http://www.bniclan.com'); 
    &#125; 
      else 
      &#123; 
      echo "Email Failed."; 
      &#125; 

?> 
<html> 
<body> 

<?php 

$to = $_POST&#1111;"to"]; 
$subject = $_POST&#1111;"subject"]; 
$message = $_POST&#1111;"msg1" + "\n\r" + "msg2" + "\n\r" + "msg3" + "\n\r" + "msg4" + "\n\r" + "msg5"]; 
$from = $_POST&#1111;"from"]; 

sent = mail($to, $subject, $message, $from); 

?> 

</body>
</html>
Understand what im trying to do? I'm tryign to have seperate forms that combine to the message and then is sent to my email. when the email is then opened then each form is on its own line.......Any Ideas?
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

use $message = $_POST["msg1"]."\n\r".$_POST["msg2"]."\n\r".$_POST["msg3"]."\n\r".$_POST["msg4"]."\n\r".$_POST["msg5"];
gavinbsocom
Forum Commoner
Posts: 71
Joined: Tue Sep 30, 2003 9:51 pm

Post by gavinbsocom »

it doesnt send ?
Nay
Forum Regular
Posts: 951
Joined: Fri Jun 20, 2003 11:03 am
Location: Brisbane, Australia

Post by Nay »

How about:

Code: Select all

$message = <<< MESSAGE
{$_POST['msg1']}
{$_POST['msg2']}
{$_POST['msg3']}
{$_POST['msg4']}
{$_POST['msg5']}
MESSAGE;
or also:

Code: Select all

$message = $_POST['msg1'] . '\r\n' . $_POST['msg2'] . '\r\n' . $_POST['msg3'] . '\r\n' . $_POST['msg4'] . '\r\n' . $_POST['msg5'];
MESSAGE;
-Nay
Post Reply