Flash and PHP

  • The_Cane_Toad
  • Born
  • Born
  • The_Cane_Toad
  • Posts: 4

Post 3+ Months Ago

Okay, I'm a total newbie, so lets get that out of the way. I'm doing a website for someone and thanks to gotoandlearn.com I have successfully created a popup page for the user to enter the usual name/email/phone information, along with a choice between two radio buttons, and then select one or more check boxes. The idea behind the page is for the user to provide their contact information and to select the topics they would like to receive more information about. Here is the Flash script:

Code: [ Select ]
 
 
stop();
 
var senderLoad:LoadVars = new LoadVars();
var receiveLoad:LoadVars = new LoadVars();
 
sender.onRelease = function() {
    senderLoad.name = name.text;
    senderLoad.email = email.text;
    senderLoad.phone = phone.text;
    senderLoad.address = address.text;
    senderLoad.radioGroup = radioGroup;
    senderLoad.hsdip = hsdip.text;
    senderLoad.tutoring = tutoring.text;
    senderLoad.learnlife = learnlife.text;
    senderLoad.SpecNeeds = SpecNeeds.text;
    senderLoad.CollegeSurvive = CollegeSurvive.text;
    senderLoad.Talent = Talent.text;
    senderLoad.CareerAdvise = CareerAdvise.text;
    senderLoad.ComService = ComService.text;
    senderLoad.FridayClub = FridayClub.text;
    senderLoad.sendAndLoad("http://www.uc-academy.com/send.php",receiveLoad);
}
 
receiveLoad.onLoad = function() {
    if(this.sentOk) {
        _root.gotoAndStop("success");
    }
    else {
        _root.gotoAndStop("failed");
    }
}
 
  1.  
  2.  
  3. stop();
  4.  
  5. var senderLoad:LoadVars = new LoadVars();
  6. var receiveLoad:LoadVars = new LoadVars();
  7.  
  8. sender.onRelease = function() {
  9.     senderLoad.name = name.text;
  10.     senderLoad.email = email.text;
  11.     senderLoad.phone = phone.text;
  12.     senderLoad.address = address.text;
  13.     senderLoad.radioGroup = radioGroup;
  14.     senderLoad.hsdip = hsdip.text;
  15.     senderLoad.tutoring = tutoring.text;
  16.     senderLoad.learnlife = learnlife.text;
  17.     senderLoad.SpecNeeds = SpecNeeds.text;
  18.     senderLoad.CollegeSurvive = CollegeSurvive.text;
  19.     senderLoad.Talent = Talent.text;
  20.     senderLoad.CareerAdvise = CareerAdvise.text;
  21.     senderLoad.ComService = ComService.text;
  22.     senderLoad.FridayClub = FridayClub.text;
  23.     senderLoad.sendAndLoad("http://www.uc-academy.com/send.php",receiveLoad);
  24. }
  25.  
  26. receiveLoad.onLoad = function() {
  27.     if(this.sentOk) {
  28.         _root.gotoAndStop("success");
  29.     }
  30.     else {
  31.         _root.gotoAndStop("failed");
  32.     }
  33. }
  34.  


The PHP script is incomplete and looks like this:

Code: [ Select ]
 
 
<?PHP
 
$to = "mymail@mymail.com";
$subject = "Request for Information";
$message = "Name: " . $name;
$message .= "E-Mail: " . $email;
$message .= "Phone number: " . $phone;
$message .= "Mailing address: " . $address;
$message .= "Please contact me via: " . $radioGroup;
 
$headers = "From: $email";
$headers .= "\nReply To: $email";
 
mail($to,$subject,$message,$headers);
 
?>
 
 
 
  1.  
  2.  
  3. <?PHP
  4.  
  5. $to = "mymail@mymail.com";
  6. $subject = "Request for Information";
  7. $message = "Name: " . $name;
  8. $message .= "E-Mail: " . $email;
  9. $message .= "Phone number: " . $phone;
  10. $message .= "Mailing address: " . $address;
  11. $message .= "Please contact me via: " . $radioGroup;
  12.  
  13. $headers = "From: $email";
  14. $headers .= "\nReply To: $email";
  15.  
  16. mail($to,$subject,$message,$headers);
  17.  
  18. ?>
  19.  
  20.  
  21.  


1. Firstly, have I handled the radio buttons correctly? They are labelled differently but both belong to radioGroup

2. How do I code the PHP to pull information from the various check boxes (assuming I've done these correctly in the Flash script i.e. the entries following the radioGroup entry)

3. Finally, I don't understand how the PHP sends the email. Do I need to associate the PHP file with a Server side file or does the PHP script just compose and send an email based on the to/from information sent to it from the Flash script?

Thanks for your patience and thanks for your help.
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • The_Cane_Toad
  • Born
  • Born
  • The_Cane_Toad
  • Posts: 4

Post 3+ Months Ago

Okay, looks like I was way off base on a couple of things (at least). I've changed the Flash script to reflect check boxes, however, I am still uncertain that I am doing this correctly. Additionally, I am still uncertain of how to handle the two radio buttons:

Code: [ Select ]
stop();
 
var senderLoad:LoadVars = new LoadVars();
var receiveLoad:LoadVars = new LoadVars();
 
sender.onRelease = function() {
    senderLoad.name = name.text;
    senderLoad.email = email.text;
    senderLoad.phone = phone.text;
    senderLoad.address = address.text;
    senderLoad.radioGroup = radioGroup.RadioButtonGroup;
    senderLoad.hsdip = hsdip.CheckBox;
    senderLoad.tutoring = tutoring.CheckBox;
    senderLoad.learnlife = learnlife.CheckBox;
    senderLoad.SpecNeeds = SpecNeeds.CheckBox;
    senderLoad.CollegeSurvive = CollegeSurvive.CheckBox;
    senderLoad.Talent = Talent.CheckBox;
    senderLoad.CareerAdvise = CareerAdvise.CheckBox;
    senderLoad.ComService = ComService.CheckBox;
    senderLoad.FridayClub = FridayClub.CheckBox;
    senderLoad.sendAndLoad("http://www.mydomain.com/send.php",receiveLoad);
}
 
receiveLoad.onLoad = function() {
    if(this.sentOk) {
        _root.gotoAndStop("success");
    }
    else {
        _root.gotoAndStop("failed");
    }
}
 
  1. stop();
  2.  
  3. var senderLoad:LoadVars = new LoadVars();
  4. var receiveLoad:LoadVars = new LoadVars();
  5.  
  6. sender.onRelease = function() {
  7.     senderLoad.name = name.text;
  8.     senderLoad.email = email.text;
  9.     senderLoad.phone = phone.text;
  10.     senderLoad.address = address.text;
  11.     senderLoad.radioGroup = radioGroup.RadioButtonGroup;
  12.     senderLoad.hsdip = hsdip.CheckBox;
  13.     senderLoad.tutoring = tutoring.CheckBox;
  14.     senderLoad.learnlife = learnlife.CheckBox;
  15.     senderLoad.SpecNeeds = SpecNeeds.CheckBox;
  16.     senderLoad.CollegeSurvive = CollegeSurvive.CheckBox;
  17.     senderLoad.Talent = Talent.CheckBox;
  18.     senderLoad.CareerAdvise = CareerAdvise.CheckBox;
  19.     senderLoad.ComService = ComService.CheckBox;
  20.     senderLoad.FridayClub = FridayClub.CheckBox;
  21.     senderLoad.sendAndLoad("http://www.mydomain.com/send.php",receiveLoad);
  22. }
  23.  
  24. receiveLoad.onLoad = function() {
  25.     if(this.sentOk) {
  26.         _root.gotoAndStop("success");
  27.     }
  28.     else {
  29.         _root.gotoAndStop("failed");
  30.     }
  31. }
  32.  


I've also made some changes to the PHP file to address the check boxes correctly, but I could use some advise on my syntax please.

Code: [ Select ]
 
<?PHP
 
$to = "me@mydomain.com";
$subject = "Request for Information";
$message = "Name: " . $name;
$message .= "E-Mail: " . $email;
$message .= "Phone number: " . $phone;
$message .= "Mailing address: " . $address;
$message .= "Please contact me via: " . $radioGroup;
<input type="checkbox" name="hsdip[]" value="High School Diploma" />
<input type="checkbox" name="tutoring[]" value="Tutoring" />
<input type="checkbox" name="learnlife[]" value="Learning for Life" />
<input type="checkbox" name="SpecNeeds[]" value="Special Needs Programs" />
<input type="checkbox" name="CollegeSurvive[]" value="College Survival Courses" />
<input type="checkbox" name="Talent[]" value="Talented and Gifted Programs" />
<input type="checkbox" name="CareerAdvise[]" value="Career and College Advisement" />
<input type="checkbox" name="ComService[]" value="Community Service and Awards Recognition" />
<input type="checkbox" name="FridayClub[]" value="Home Schoolers Friday Club" />
 
 
$headers = "From: $email";
$headers .= "\nReply To: $email";
 
mail($to,$subject,$message,<input type>,$headers);
 
?>
  1.  
  2. <?PHP
  3.  
  4. $to = "me@mydomain.com";
  5. $subject = "Request for Information";
  6. $message = "Name: " . $name;
  7. $message .= "E-Mail: " . $email;
  8. $message .= "Phone number: " . $phone;
  9. $message .= "Mailing address: " . $address;
  10. $message .= "Please contact me via: " . $radioGroup;
  11. <input type="checkbox" name="hsdip[]" value="High School Diploma" />
  12. <input type="checkbox" name="tutoring[]" value="Tutoring" />
  13. <input type="checkbox" name="learnlife[]" value="Learning for Life" />
  14. <input type="checkbox" name="SpecNeeds[]" value="Special Needs Programs" />
  15. <input type="checkbox" name="CollegeSurvive[]" value="College Survival Courses" />
  16. <input type="checkbox" name="Talent[]" value="Talented and Gifted Programs" />
  17. <input type="checkbox" name="CareerAdvise[]" value="Career and College Advisement" />
  18. <input type="checkbox" name="ComService[]" value="Community Service and Awards Recognition" />
  19. <input type="checkbox" name="FridayClub[]" value="Home Schoolers Friday Club" />
  20.  
  21.  
  22. $headers = "From: $email";
  23. $headers .= "\nReply To: $email";
  24.  
  25. mail($to,$subject,$message,<input type>,$headers);
  26.  
  27. ?>


Any and all comments will be greatly appreciated.
  • The_Cane_Toad
  • Born
  • Born
  • The_Cane_Toad
  • Posts: 4

Post 3+ Months Ago

*bump*

Anyone? Anyone? Beuller?
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23456
  • Loc: Woodbridge VA

Post 3+ Months Ago

Must have missed this one last month. Any chance you could post a link to your FLA? Your second attempt is way off on the php. You can't put the input tags in your php mailer script. I'm reasonably competent with mailer forms as are others here, but it would help to see how your form is set up.
  • The_Cane_Toad
  • Born
  • Born
  • The_Cane_Toad
  • Posts: 4

Post 3+ Months Ago

Here is a link to the relevant files.

http://www.nadc.com/utils/Jason/Form_Help/

As I mentioned earlier, I am a complete newbie to PHP and only a novice Flash user. Bouncing from one tutorial to the next is proving to be both confusing and frustrating. Your help will be greatly appreciated.
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23456
  • Loc: Woodbridge VA

Post 3+ Months Ago

just FYI I did look, but at the moment not following at all what you did
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23456
  • Loc: Woodbridge VA

Post 3+ Months Ago

Did you figure this out? I just worked through your FLA and there were no script errors or compile errors. however, your AS has your php file located at http://www.mydomain.com/send.php

that needs to be changed to your actual domain name, or make the path relative and make it send.php and make sure send.php is in same directory as your Flash file.


Also send.php exists in your directory link, but I can't seem to save or open it to see the contents. Perhaps put that in a zip file and include that in your directory.

Post Information

  • Total Posts in this topic: 7 posts
  • Users browsing this forum: No registered users and 4 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.