Results 1 to 4 of 4

Thread: Flash form Being Processed by PHP

  1. #1
    Join Date
    Oct 2008
    Posts
    8
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default Flash form Being Processed by PHP

    I have just completed building a flash website that contains a contact form. Everything is working perfectly with the form except 1 thing... Whenever i recieve the email it still contains the Array Field Descriptions, and lists them after the actual content. So if i was to fill out the form with this information,

    Name Field: John Johnson
    Email Field: John@johnson.com
    Subject Field: This is the subject
    Message Field: this is the message

    It would display it in my email like this:

    Name:

    John JohnsonYour Name:

    --------------------------------------------------------------------------------------------------------
    Email:

    John@Johnson.comYour Email:

    --------------------------------------------------------------------------------------------------------
    Subject:

    This is the SubjectSubject:

    --------------------------------------------------------------------------------------------------------
    Message:

    This is the MessageMessage:

    --------------------------------------------------------------------------------------------------------

    See how it still contains the Flash forms Field descriptions??? and lists it after the actual content?? I just want them taken out and cant figure out how.

    Here Is my Action Script for the Frame:
    Code:
    rec="ice@template-help.com";
    serv="php";
    
    var fields_descriptions= Array ("", 
    					Array("t1", "name", "Your Name"), 
    					Array("t2", "email", "Your Email:"),
    					Array("t3", "subject", "Subject:"),
    					Array("t4", "message", "Message:"),
    								);
    
    function reset_txt(name,name2,value) {
    		path=eval(_target);
    		path[name2]=value;
    	
    	this[name].onSetFocus=function() {
    		path=eval(_target);
    		if(path[name2]==value) { path[name2]="";} 
    	}
    	
    	this[name].onKillFocus=function() {
    		path=eval(_target);
    		if(path[name2]=="") { path[name2]=value;} 
    	}
    }
    
    
    for (i=1; i<=fields_descriptions.length; i++) {
    	reset_txt("t"+i, fields_descriptions[i][1], fields_descriptions[i][2]);
    }
    Here is the Code with the Submit Button:
    Code:
    on (rollOver) {
    	this.gotoAndPlay("s1");
    }
    
    on(rollOut, releaseOutside) {;
    this.gotoAndPlay(this._totalframes-this._currentframe);
    
    }
    
    on (release) {
    for (i=1; i<_parent.fields_descriptions.length; i++) {
    	if (_parent[_parent.fields_descriptions[i][1]] != _parent.fields_descriptions[i][2]) {
    		this[_parent.fields_descriptions[i][1]] = _parent[_parent.fields_descriptions[i][1]]+_parent.fields_descriptions[i][2];
    	}
    	_parent.reset_txt(_parent["t"+i],_parent.fields_descriptions[i][1],_parent.fields_descriptions[i][2]);
    }
    
    this.recipient = _parent.rec;
    //i=undefined;
    getURL("contact."+_parent.serv, "_blank", "POST");
    
    }
    And here is my PHP Code:

    PHP Code:
    <?PHP

     
    while ($request current($_REQUEST)) {
         if (
    key($_REQUEST)!='recipient') {
            
    $pre_array=split ("&777&",  $request);
            
            
    $post_vars[key($_REQUEST)][0]=preg_replace ("/<[^>]*>/"""$pre_array[0]);
        }
        
    next($_REQUEST);
    }



    reset($post_vars);


    $to="myemail@email.com";
    $subject="Email from your website";
    $message ="Name:\n\n ".$_POST['name'];
    $message .="\n\n--------------------------------------------------------------------------------------------------------\n";  
    $message .="Email:\n\n "$_POST['email'];
    $message .="\n\n--------------------------------------------------------------------------------------------------------\n";
    $message .="Subject:\n\n "$_POST['subject'];
    $message .="\n\n--------------------------------------------------------------------------------------------------------\n";
    $message .="Message:\n\n "$_POST['message'];
    $message .="\n\n--------------------------------------------------------------------------------------------------------\n";
    $headers .="From: $name";
    $headers .="Reply-To: $email";

    $sentOk=mail($to,$subject,$message,$headers);
    echo 
    "Your Message has been Sent!" $sentOK;

    ?>
    Like i said, everything is working brilliantly except for that... There has got to be some way that i can remove those "Arrays"... I tried "Unset" but didn't have any luck.... PLEASE RESCUE ME!!!!!!

    if you want to view the form online, it is on my website, http://www.clarkwells.com. Just go there and then click on "Contact Clark"
    Last edited by Clark Wells; 10-18-2008 at 01:26 AM.

  2. #2
    Join Date
    Oct 2008
    Posts
    8
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    60 views and nobody?????? The solution is bound to not be very difficult.... I am just to new to php and flash integration to know..... Someone Help!!!!!

  3. #3
    Join Date
    Oct 2008
    Posts
    8
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    I just added to my PHP to require all of the fields to be completed. My PHP now looks like this:
    PHP Code:
    <?PHP

    if(trim($_POST['name']) == "") {
      die(
    "You did not fill out a Name! All fields must be completed!");
    }
    if(
    trim($_POST['email']) == "") {
      die(
    "You did not fill out a Email! All fields must be completed!");
    }
    if(
    trim($_POST['subject']) == "") {
      die(
    "You did not fill out a Subject! All fields must be completed!");
    }
    if(
    trim($_POST['message']) == "") {
      die(
    "You did not fill out a Message! All fields must be completed!");
    }

     while (
    $request current($_REQUEST)) {
         if (
    key($_REQUEST)!='recipient') {
            
    $pre_array=split ("&777&",  $request);
            
            
    $post_vars[key($_REQUEST)][0]=preg_replace ("/<[^>]*>/"""$pre_array[0]);
        }
        
    next($_REQUEST);
    }



    reset($post_vars);


    $to="cwells@clarkwells.com";
    $subject="Email from ClarkWells.com";
    $message ="Name:\n\n ".$_POST['name'];
    $message .="\n\n--------------------------------------------------------------------------------------------------------\n";  
    $message .="Email:\n\n "$_POST['email'];
    $message .="\n\n--------------------------------------------------------------------------------------------------------\n";
    $message .="Subject:\n\n "$_POST['subject'];
    $message .="\n\n--------------------------------------------------------------------------------------------------------\n";
    $message .="Message:\n\n "$_POST['message'];
    $message .="\n\n--------------------------------------------------------------------------------------------------------\n";
    $headers .="From: $name";
    $headers .="Reply-To: $email";

    $sentOk=mail($to,$subject,$message,$headers);
    echo 
    "Your Message has been Sent!" $sentOK;

    ?>

  4. #4
    Join Date
    Oct 2008
    Posts
    8
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default Resolved

    I have just used about 3 days of straight trial and error to discover the solution. This is the PHP code for my new contact form. I found that instead of just calling the Field names, such as: $name, I have to first call the field name and then defined that i do not want the array value posted.

    The Code Looks like this:

    PHP Code:
    $message .="Email:".$post_vars['email'][0] ; 
    The Entire Script:


    PHP Code:
    <?PHP

    if(trim($_POST['name']) == "") {
      die(
    "You did not fill out a Name! All fields must be completed!");
    }
    if(
    trim($_POST['email']) == "") {
      die(
    "You did not fill out a Email! All fields must be completed!");
    }
    if(
    trim($_POST['subject']) == "") {
      die(
    "You did not fill out a Subject! All fields must be completed!");
    }
    if(
    trim($_POST['message']) == "") {
      die(
    "You did not fill out a Message! All fields must be completed!");
    }

     
    Error_Reporting(E_ALL & ~E_NOTICE);

     while (
    $request current($_REQUEST)) {
         if (
    key($_REQUEST)!='recipient') {
            
    $pre_array=split ("&777&",  $request);
            
            
    $post_vars[key($_REQUEST)][0]=preg_replace ("/<[^>]*>/"""$pre_array[0]);
            
    $post_vars[key($_REQUEST)][1]=preg_replace ("/<[^>]*>/"""$pre_array[1]);
        }
        
    next($_REQUEST);
    }



    reset($post_vars);


    $to="cwells@clarkwells.com";
    $subject="".$post_vars['subject'][0] ;
    $message ="Name:\n\n".$post_vars['name'][0] ;
    $message .="\n\n--------------------------------------------------------------------------------------------------------\n";  
    $message .="Email:\n\n".$post_vars['email'][0] ;
    $message .="\n\n--------------------------------------------------------------------------------------------------------\n";
    $message .="Subject:\n\n ".$post_vars['subject'][0] ;
    $message .="\n\n--------------------------------------------------------------------------------------------------------\n";
    $message .="Message:\n\n ".$post_vars['message'][0] ;
    $message .="\n\n--------------------------------------------------------------------------------------------------------\n";
    $headers .="From: ClarkWells.com";

    $sentOk=mail($to,$subject,$message,$headers);
    echo 
    "Your Message has been Sent!" $sentOK;

    ?>

Bookmarks

Posting Permissions

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