Forum Moderators: coopster
HTML
<form action="email.php">
<div>
<p><label for="name">Name</label> <input type="text" id="name" /></p>
<p><label for="email">e-mail</label> <input type="text" id="email" /></p>
<p><label for="subject">Subject</label> <input type="text" id="subject" /></p>
<textarea title="Write your message here" name="message" id="message" cols="60" rows="10">
</textarea>
<p class="submit"> <input type="submit" value="Submit" />
</p>
</div>
</form>
PHP
<?php$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: webmaster@example.com\r\n";
$headers .= "Reply-To: webmaster@example.com\r\n";
$headers .= "X-Mailer: PHP/" . phpversion();
//CHANGE ME!
$to = 'testing@testing.com, testing2@testing.eu'; //Email address the comment will
$fromn = $_POST['name'];
$frome = $_POST['email'];
$subject = $_POST['subject'];
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: $fromn <$frome>\r\n";
$headers .= "Reply-To: $fromme\r\n";
$headers .= "X-Mailer: PHP/" . phpversion();
$content = str_replace("\n.", "\n..", $_POST['content']);
$content = "From $fromn :: $frome \n \n" . $content;
mail("".$to."", $subject, $content, $headers);
?>
Thank you. We will contact you shortly.
yes
>> How do I dump a post?
using the code I posted on your script that does the mailing
I tested using this
<form method="post" action="cssformproc.php">
<div>
<p><label for="name">Name</label> <input type="text" name="name" id="name" /></p>
<p><label for="email">e-mail</label> <input type="text" name="email" id="email" /></p>
<p><label for="subject">Subject</label> <input type="text" name="subject" id="subject" /></p>
<textarea title="Write your message here" name="message" id="message" cols="60" rows="10">
</textarea>
<p class="submit"> <input type="submit" value="Submit" />
</p>
</div>
</form>
and the cssformproc.php file was only this
<?
echo '<pre>';
print_r($_POST);
echo '</pre>';
?>
it worked once I added the 2 things mentioned element names and the form method
Array
(
[name] => Mehdi
[email] => test@test.com
[subject] => This Better Work
[message] => It doesn\'t.
)
I then removed :
<form method="post" action="cssformproc.php">
and replaced it with :
<form method="post" action="email.php">
and used the code you list above :
<form method="post" action="email.php">
<div>
<p><label for="name">Name</label> <input type="text" name="name" id="name" /></p>
<p><label for="email">e-mail</label> <input type="text" name="email" id="email" /></p>
<p><label for="subject">Subject</label> <input type="text" name="subject" id="subject" /></p>
<textarea title="Write your message here" name="message" id="message" cols="60" rows="10">
</textarea>
<p class="submit"> <input type="submit" value="Submit" />
</p>
</div>
</form>
Still doesn't work. I ran the form on two domains. On domain one I get :
Subject, date, to. Empty from header and no body.
On domain two I get :
Subject, from, date, to. Empty body.
Chmod is set to 755 for the email.php form.
it not working on the first domain is strange, the second domain seems to be doing what it should
<added>I see you edited while I was posting, the missing from, could be a different setting if you are using the exact same code
'
displays as :
'\
And the form doesn't recognise line returns e.g.
In a few seconds I will reach the end of the line and start a new paragraph.
This is the new paragraph.
Shows up as :
In a few seconds I will reach the end of the line and start a new paragraph. This is the new paragraph.
you could parse the content from the textarea and change \n to \r\n to see if that makes any difference
try using str_replace [php.net]
<form method="post" action="email.php">
<div>
<p><label for="name">Name</label> <input type="text" name="name" id="name" /></p>
<p><label for="email">e-mail</label> <input type="text" name="email" id="email" /></p>
<p><label for="subject">Subject</label> <input type="text" name="subject" id="subject" /></p>
<textarea title="Enter your message here" name="message" id="message" cols="60" rows="10">
</textarea>
<p class="submit"> <input type="submit" value="Submit" />
</p>
</div>
</form>
the reason your cursor is on the second line is because you have a hard return in there
change
<textarea title="Enter your message here" name="message" id="message" cols="60" rows="10">
</textarea>
to
<textarea title="Enter your message here" name="message" id="message" cols="60" rows="10"></textarea>