Jump to content

Help transfering variables and emailing via php mail() function please


graphixman

Recommended Posts

Ok, Ill be the first to say I am a complete noob at PHP. I am trying to do something very simple: using input text fields in a flash object (.swf) upload the variables from that input text into a simple php script to email the variables for the input text fields to a email address. I cant get it to work and I cant find any errors in the code, could someone look over my code and see if they see what I'm missing?

 

This is the script to upload the variables out of the input text fields:

on (release) {
    userName.text = "";
    userEmail.text = "";
    userSubject.text = "";
    userDepartment.text = "";
    userMessage.text = "";
}

 

and this is the PHP code to receive the variables and send them:

<?php

$name = $_POST["Name"];
$email = $_POST["Email"];
$Subject = $_POST["Subject"];
$department = $_POST["Department"];
$message = $_POST["Message"];

$message = stripslashes($message);

$sendTo = "[email protected]";
$subject = "Message from Contact Form";

$msg_body = "Name:  $name\n";
$msg_body .= "E-Mail:  $email\n";
$msg_body .= "Subject:  $subject\n";
$msg_body .= "Department:  $department\n";
$msg_body .= "Message:  $message\n";

$header_info = "From: ".$name." <".$email.">";

mail($sendTo, $subject, $msg_body, $header_info);

?>

 

Can anybody help me understand why it doesnt work? all help greatly appreciated!

 

Sorry, the first code is incorrect, this is the correct code:

 

on (release) {
    var Name = userName.text;
    var Email = userEmail.text;
    var Subject = userSubject.text;
    var Department = userDepartment.text;
    var Message = userMessage.text;
    loadVariables("contact.php",'POST');
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.