PDA

View Full Version : php mail form


astroscout7
08-24-2004, 10:58 PM
Hello!

I put together this email form and it works great for me when I submit it, but when my client submits it nothing shows up in the email!? I cannot figure out what is making it not work ... is it a Mac/PC thing (I am on a MAC.. and I can only assume my client isn't!)

Here's what I've got on my submit button:
submitBTN.onRelease = function() {
getURL("http://www.4oakscollegegroup.com/flash/CONTACT/contact_thecore.php", "_blank", "POST");
};

and here's my php:
<?PHP
$to = "thecore@4oakscollegegroup.com";
$subject = "*4oakscollegegroup.com - VITAL STATS";
$headers = "From: Form Mailer";
$forward = 0;
$location = "";

$date = date ("l, F jS, Y");
$time = date ("h:i A");



$msg = "Below is the result of your feedback form. It was submitted on $date at $time.\n\n";

if ($_SERVER['REQUEST_METHOD'] == "POST") {
foreach ($_POST as $key => $value) {
$msg .= ucfirst ($key) ." : ". $value . "\n";
}
}
else {
foreach ($_POST as $key => $value) {
$msg .= ucfirst ($key) ." : ". $value . "\n";
}
}

mail($to, $subject, $msg, $headers);
if ($forward == 1) {
header ("Location:$location");
}
else {
echo "© four oaks college group";
}

?>

Any ideas ... anyone!?
Thanks!

snapple
09-01-2004, 09:43 AM
But you don't have any error handling in there at all, so how would it know? You'd either have to have it in the php script, something like:


$name = $HTTP_POST_VARS['name'];
$password = $HTTP_POST_VARS['password'];

if(empty($name)||empty($password))
{
//send a variable back and ask flas to act upon that
}


Or do it on the client side with something like:


if(_root.mailTitle.text == "" || _root.mail.Author.text == "" || _root.mail.Body.text == "" )
{
//error handling
}
else
{
//use loadVars();
}
}


Regards, snapple :)