PDA

View Full Version : PHP email



JustSara
December 31st, 2002, 11:34 AM
Hello all and Happy Holidays. I have a Flash form set up on my website (and a sniffer thanks to you guys!) but for those few that don't have Flash I'd like to have a simple submit form using PHP. I went and bought a book about Dreamweaver which is pretty good but I'm confused. Also, my website is hosted on an ISP's website so I have very limited access to it.

In the book, for PHP email, it has this code:

<--!
<?php
$email_to = "me@me.com";
$email_subject = "This is the email\n";
$email_body = "Body text here!\n";

if (mail (@email_to, $email_subject, @email_body))
echo "Mail sent.";
else echo "Mail failed.";
?>
-->

I don't know what to do with this code. Do I put it on the page with my submit form? Is this supposed to be server side code? Any help will be much appreciated.

JustSara

Jubba
December 31st, 2002, 03:57 PM
Do a search of the forums (the button on the top-right that says 'search'). That should help, this question, or questions similar to this have been asked millions of times before...

IceCube
December 31st, 2002, 04:18 PM
this topic was posted 3-4 days ago...
heres my submisision for a phpmail script..
If you change the html code with the appropreiate flash code, im sure you can use it for something...


<?php
ob_start("mail");
if ( $_POST['submit'] )
{
$reciever = $_POST['reciever'];
$header = $_POST['header'];
$text= $_POST['text'];
mail($reciever,$header,$text);
header($_SERVER['PHP_SELF']);
ob_end_flush("mail");
ob_end_clean("mail");
}
print("<form action='".$_SERVER['PHP_SELF']."' method='post'");
print("reciever:<input type='text' name='reciever'>");
print("header:<input type='text' name='header'>");
print("text:<textarea width=20 height=40 type='text' name='text'></textarea>");
ob_end_flush("mail");
ob_end_clean("mail";