Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    May 2008
    Posts
    70
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Add additonal field to contact

    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.)

    Code:
    <?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

  • #2
    Regular Coder Iszak's Avatar
    Join Date
    Jun 2007
    Location
    Perth, Western Australia
    Posts
    332
    Thanks
    2
    Thanked 58 Times in 57 Posts
    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..

  • #3
    New Coder
    Join Date
    May 2008
    Posts
    70
    Thanks
    4
    Thanked 0 Times in 0 Posts
    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

    Code:
     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

    Eddie


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •