Web Hosting Talk







View Full Version : Need Help On PHP Form


BlueSun
01-26-2009, 09:31 PM
I'm relatively new at Php actually I just started reading it's code this week but I am experience in other languages also anyway I'm having problems with this code I have written.
Basically like I said before I want my viewers to post me form messages on my website to my email. I'm using 100webspace.net as a host right now. I set the header location to google dot com because I seem to not be able to send it back to the url I made on my site for a type of thank you response after the viewer submits his written form to me.
So after I did my 5th test I submitted & it sent me to google.com but I still haven't received any of my post that I submitted in each test to my email inbox & I don't know what I'm doing wrong to not have this happen, maybe you can help?
<?php
$email = $_REQUEST['email'] ;
$message = $_REQUEST['message'] ;
mail( "htp://redhood2009@livedotcom", "Feedback Form Results",
$message, "From: $email" );
header( "Location: htp://wwwdotgoogledotcom" );
?>

FA Web
01-27-2009, 01:24 AM
Try this. I', sure it will help. Don't forget to use the post methode in your form.
<?php
$email = $_POST['email'];
$message = $_POST['message'];
$headers = "MIME-Version: 1.0\n";
$headers ='From: ' . $email .''."\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\n";
$headers .='Content-Transfer-Encoding: 8bit';
//No HTML code in the variables
$email = htmlspecialchars($email);
$message = htmlspecialchars($message);
//Allow "enter" in text
$message = nl2br($message);
$to = "youremail@yourdomain.com";
$subject = "Enter your subject";
if(mail($to, $subject, $message, $headers))
{print "Enter your thank you message";
}
else
{print "Enter you error message"; }
?>