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
    Roc
    Roc is offline
    New Coder
    Join Date
    Jul 2007
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Having problem with a flash form

    I was following the tutorial here for making a form in flash and then sending the collected data to a mail address using PHP.

    The setup doesnt seem to work as I did not get any email. Can anyone help me find a solution to this or let me know how to troubleshoot it?

    Here is the actionscript
    Code:
    stop();
    // Making the default setting for below mentioned textfields
    fname = "";
    lname = "";
    email = "";
    phone = "";
    college = "";
    events = "";
    	// Making '*' Marks Invisible
    	fnamemark._visible = false;
    	lnamemark._visible = false;
    	emailmark._visible = false;
    	phonemark._visible = false;
    	collegemark._visible = false;
    	eventsmark._visible = false;
    //
    //-------------------------------------------------------
    // Submit Button action
    btnSubmit.onRelease = function() {
    	//Add Path of the php file
    	feedbackpath = "mailto.php";
    	//
    	str1 = email.indexOf("@");
    	str2 = email.indexOf("@")+1;
    	str3 = email.charAt(str1+1);
    	str4 = email.lastIndexOf(".");
    	str5 = email.charAt(str4+1);
    	len = length(email);
    	counter = 1;
    	flag = 0;
    	while (Number(counter)<=Number(len)) {
    		Char = substring(email, counter, 1);
    		if (Char ne "@") {
    			flag = Number(flag)+1;
    		}
    		counter = Number(counter)+1;
    	}
    	//
    	//First Name field validation
    	if (fname == "") {
    		condition1 = "";
    		fnamemark._visible = true;
    	} else {
    		condition1 = "ok";
    		fnamemark._visible = false;
    	}
    	
    	//Last Name field validation
    	if (lname == "") {
    		condition2 = "";
    		lnamemark._visible = true;
    	} else {
    		condition2 = "ok";
    		lnamemark._visible = false;
    	}
    	
    	//E-Mail Address validation
    	if (str4<=str2 || str3 == "." || str5 == "" || Number(flag) != Number(len-1)) {
    		condition3 = "";
    		emailmark._visible = true;
    	} else {
    		condition3 = "ok";
    		emailmark._visible = false;
    	}
    	
    	//Phone field validation
    	if (phone == "") {
    		condition4 = "";
    		phonemark._visible = true;
    	} else {
    		condition4 = "ok";
    		phonemark._visible = false;
    	}
    	
    	//College field validation
    	if (college == "") {
    		condition5 = "";
    		collegemark._visible = true;
    	} else {
    		condition5 = "ok";
    		collegemark._visible = false;
    	}
    	
    	//Events field validation
    	if (events == "") {
    		condition6 = "";
    		eventsmark._visible = true;
    	} else {
    		condition6 = "ok";
    		eventsmark._visible = false;
    	}
    	
    	//Sending data to php file only if all the above validations are fulfilled
    	if (condition1 == "ok" && condition2 == "ok" && condition3 == "ok" && condition4 == "ok" && condition5 == "ok" && condition6 == "ok") {
    		loadVariablesNum(feedbackpath+"&fname="+fname+"&lname="+lname+"&email="+email+"&phone="+phone+"&college="+college+"&events="+events, 0);
    		gotoAndStop(2);
    	}
    };
    //
    //-------------------------------------------------------
    // Reset Button action
    btnReset.onRelease = function() {
    	// Making the default setting for below mentioned textfields
    	fname = "";
    	lname = "";
    	email = "";
    	phone = "";
    	college = "";
    	events = "";
    	// Making '*' Marks Invisible
    	fnamemark._visible = false;
    	lnamemark._visible = false;
    	emailmark._visible = false;
    	phonemark._visible = false;
    	collegemark._visible = false;
    	eventsmark._visible = false;
    };
    And the PHP code
    Code:
    <?
    //Destination Email ID
    $to = "xxx@gmail.com";
    
    //First Name of the Person
    $fnamenew = $_GET['fname'];
    
    //Last Name of the Person
    $lnamenew = $_GET['lname'];	
      
    //Email Id of the person
    $emailnew = $_GET['email'];	  
    
    //Phone of the person
    $phonenew = $_GET['phone'];
    
    //College of the person
    $collegenew = $_GET['college'];
    
    //Event Names
    $eventsnew = $_GET['events']; 
    
    //Subject line of the email
    $subject = "Registration:"." "."$collegenew"." "."$fnamenew"." "."$lnamenew";  
    
    /*********** Email body *******************/
    $matter = "Below are the registration details\n\n".  
    	  "First Name:"." "."$fnamenew"."\n\n".
    	  "Last Name:"." "."$lnamenew"."\n\n".
    	  "Email:"." "."$emailnew"."\n\n".
    	  "Phone:"." "."$phonenew"."\n\n".
    	  "College:"." "."$collegenew"."\n\n".
    	  "Events:"." "."$eventsnew"."\n\n";
    /**********************************************/	   
    	   
    
    mail("$to", "$subject","$matter","From: $emailnew");
    
    ?>
    Last edited by Roc; 01-03-2008 at 02:00 PM.

  • #2
    Roc
    Roc is offline
    New Coder
    Join Date
    Jul 2007
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Sorry for the trouble.. got the solution

    loadVariablesNum(feedbackpath+"&fname="+fname+"&lname="+lname+"&email

    loadVariablesNum(feedbackpath+"?fname="+fname+"&lname="+lname+"&email

    There lies the problem.

  • #3
    Senior Coder gnomeontherun's Avatar
    Join Date
    Sep 2007
    Location
    Houston
    Posts
    2,846
    Thanks
    10
    Thanked 238 Times in 229 Posts
    Good work on checking your own code and using supersluthing skills! The concern with your original post was that it did not give much information about what worked, so we know where the issue could be. Also when working with PHP, the issue could be PHP and not flash, so all of these things would be helpful in a future post to give us the details.
    jeremy - gnomeontherun
    Educated questions often get educated answers, and simple questions often get simple answers.


  •  

    Posting Permissions

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