PHP mail() question
Posted: Tue Aug 22, 2006 5:43 pm
I have this tiny program made to help my friend send poems from a form with 4 variables,
the name of the sender, the senders email, the senders title of their poem, and finally their poem.
My problem is, I want the poem to have line breaks where the poet wants them. But instead when the program reads the mail input it send it all in one line. I was thinking maybe just adding ASCII space "/n" isthis what I want? Or what? Here is my program thus far, form and all.
simple_form.htm
Here is the PHP to go with the form.
the name of the sender, the senders email, the senders title of their poem, and finally their poem.
My problem is, I want the poem to have line breaks where the poet wants them. But instead when the program reads the mail input it send it all in one line. I was thinking maybe just adding ASCII space "/n" isthis what I want? Or what? Here is my program thus far, form and all.
simple_form.htm
Code: Select all
<form action="send_simpleform.php" method="POST">
<p><b>your name</b>
<input type="text" name="name" size="30"></p>
<p><b>your email</b>
<input type="text" name="sender_email" size="30"></p>
<p><b>your title</b>
<input type="text" name="title" size="30"></p>
<p><b>your poem</b>
<TEXTAREA NAME="poem" COLS="30" ROWS="5" WRAP="virtual"></TEXTAREA></P>
<p><input type="submit" name="submit" value="send your poem!"></p>Code: Select all
<?php
if ($_POST['name'] = "" &&
$_POST['sender_email'] = "" &&
$_POST['title'] = "" &&
$_POST['poem'] ="")
{
echo "Please fill out all boxes so I can see your great work";
}
else {
$msg = "E-MAIL SENT FROM THE CHATAHOLIC POETRY PAGE\n";
$msg .= "Sender's NAME: \t{$_POST['name']}\n";
$msg .= "Sender's EMAIL:\t{$_POST['sender_email']}\n";
$msg .= "Sender's TITLE:\t{$_POST['title']}\n";
$msg .= "Sender's POEM:\t{$_POST['poem']}\n";
$to = "kiddo@chatsaholic.com\n";
$subject = "Poetry Submission\n";
$mailtoheaders = "From: Malina <kiddo@chatsaholic.com>\n";
$mailheaders .= "Reply-To: {$_POST['sender_email']}\n";
mail($to, $subject, $msg, $mailheaders);
}
?>
<html>
<head>
</head>
<body>
<h1> the following email has been sent!</h1>
<P><b>Your Name:</b><br>
<?php echo $_POST['name']; ?>
<P><b>Your E-Mail Address:</b><br>
<?php echo $_POST['sender_email']; ?>
<P><b>title:</b><br>
<?php echo $_POST['title']; ?>
<P><b>poem:</b><br>
<?php echo $_POST['poem']; ?>
<FORM>
<INPUT type="button" value="Click here to go back" onClick="history.back()">
</FORM>
</body>
</html>