View Full Version : Add additonal field to contact

07-16-2008, 04:22 AM
Hi im trying to use PHP with flash for my contact form. I retrieved a script from macromedia which works fine but I need to add a name field to this. Ive tried the obvious additions but because I know little about PHP it looks like ive done something wrong, (all the new fields ive added have a 'fullname' to it.)


// read the variables form the string, (this is not needed with some servers).
$fullname = $_REQUEST["fullname"];
$subject = $_REQUEST["subject"];
$message = $_REQUEST["message"];
$sender = $_REQUEST["sender"];

// include sender IP in the message.
$full_message = $_SERVER['REMOTE_ADDR'] . "\n\n" . $message;
$message= $full_message;

// remove the backslashes that normally appears when entering " or '
$fullname = stripslashes($fullname);
$message = stripslashes($message);
$subject = stripslashes($subject);
$sender = stripslashes($sender);

// add a prefix in the subject line so that you know the email was sent by online form
$subject = "Contact form ". $subject;

// send the email, make sure you replace email@yourserver.com with your email address
if(isset($message) and isset($fullname) and isset($subject) and isset($sender)){
mail("hiphopbiter@hotmail.com", $subject, $message, $fullname, "From: $sender");

Can anyone see whats wrong with this?



07-16-2008, 04:25 AM
personally? I would prefer an error response.. also do you want to use $_REQUEST? Because if it's via a form ($_POST).. then people could abuse it via $_GET..

07-16-2008, 04:41 AM
there is no error message as the flash says its sent but i just do not receive the form content unless i remove the fullname info. The PHP links to this flash actionscript

System.useCodepage = true;
send_btn.onRelease = function() {
my_vars = new LoadVars();
my_vars.fullname = fullname_box.text;
my_vars.sender = email_box.text;
my_vars.subject = subject_box.text;
my_vars.message = message_box.text;
if (my_vars.sender != "" and my_vars.subject != "" and my_vars.fullname != "" and my_vars.message != "") {
my_vars.sendAndLoad("mailer.php", my_vars, "POST");
} else {
my_vars.onLoad = function() {
email_box.onSetFocus = subject_box.onSetFocus = fullname_box.onSetFocus = message_box.onSetFocus=function () {
if (error_clip._currentframe != 41) {

As i said im a flash designer and only used basic PHP and actionscript in the past so didnt want to touch with any of the working code but just wanted to add an additional field which i hoped wouldnt be too hard :confused: