...

View Full Version : Add additonal field to contact



Eddie_E
07-16-2008, 03: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.)



<?php

// 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?

thx

Eddie

Iszak
07-16-2008, 03: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..

Eddie_E
07-16-2008, 03: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


stop();
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");
gotoAndStop(42);
} else {
error_clip.gotoAndPlay(42);
}
my_vars.onLoad = function() {
gotoAndStop(43);
};
};
email_box.onSetFocus = subject_box.onSetFocus = fullname_box.onSetFocus = message_box.onSetFocus=function () {
if (error_clip._currentframe != 41) {
error_clip.gotoAndPlay(6);
}
};

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:

Eddie



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum