View Full Version : Php Email Form Help!


Newb_need_help
11-27-2005, 07:46 PM
I searched every where for help i just dont get what i am doing wrong!

This is my form:
<form method="post" ENCTYPE="text/plain" action="request1.php">
<p>
<input type="text" name="name" value="Name"><br>
<input type="text" name="email" value="Email"><br>
<input type="text" name="song" value="Name of Song"><br>
<input type="text" name="artist" value="Artist"><br>
<input type="text" name="anime" value="Anime Series"><br>


<input type="submit" name="request" value="Request">
<input type="reset" name="clear" value="Clear all"></p>
</form>




And this is the request1.php:
<?php
$to = "anime360x@yahoo.com";
$from = $_POST['from'];
$subject = $_POST['email'];
$name = $_POST['name'];
$message = $_POST['song'];
$artist = $_POST['artist'];
$anime = $_POST['anime'];
$headers = "From: $from\r\n";
$success = mail($from, $subject, $name);

if ($success)
echo "The request was successfully sent";
else
echo "An error occurred when sending the email";
?>


Well i need major help :dead: :dead:

Douglas
11-27-2005, 09:31 PM
youre using the mail() function wrong, its mail($address, $subject, $body, $headers);

putnamehere
11-27-2005, 09:42 PM
and were it says if($success) thers no { and }
it need be
if ($success)
{
echo "The request was successfully sent";
} else {
echo "An error occurred when sending the email";
}

Douglas
11-27-2005, 09:50 PM
So basically like this:


<?php
$to = "anime360x@yahoo.com";
$from = $_POST['from'];
$subject = $_POST['email'];
$name = $_POST['name'];
$message = $_POST['song'];
$artist = $_POST['artist'];
$anime = $_POST['anime'];
$body="Name".$name."\nSong".$message."\nArtist".$artist."\nAnime:".$anime;
$headers="From: <$from>\r\n";
$success=mail($to, $subject, $body, $headers);

if ($success) {
echo "The request was successfully sent";
}
else {
echo "An error occurred when sending the email";
}
?>

Newb_need_help
11-27-2005, 10:24 PM
Big Thanks, !!! U Ppl Are The Bestest! :)

Douglas
11-27-2005, 11:10 PM
No problem, hope it works out ;)

putnamehere
11-28-2005, 12:23 AM
again np ;0

Newb_need_help
11-29-2005, 09:04 PM
I just tested it out... it didnt work... >_<
The emails can send.. when i thought it could i thought it could work anyway... but when i inserted text to the forms... it didnt work.. only the questions poped up