mailer.php almost works :|

Reply

Join Date: Oct 2007
Posts: 1
Reputation: onyxtacular is an unknown quantity at this point 
Solved Threads: 0
onyxtacular onyxtacular is offline Offline
Newbie Poster

mailer.php almost works :|

 
0
  #1
Oct 30th, 2007
Hi Everyone,
Another newby here with hat in hand. I'm working on a basic flash/php mail program. Working with the template provide from a website; I want some additional fields to the formmail. So I added some text boxes to the .FLA file which sends the variables to the PHP file.

I thought it would be simple enough to do, but I'm still not getting the output I want; showing all the text fields in the email.

This is the actionscript for the .FLA file

actionscript Syntax (Toggle Plain Text)
  1. stop();
  2.  
  3. name_box.tabIndex = 1;
  4. phone_box.tabIndex = 2;
  5. subject_box.tabIndex = 3;
  6. email_box.tabIndex = 4;
  7. street_box.tabIndex = 5;
  8. po_box.tabIndex = 6;
  9. city_box.tabIndex = 7;
  10. state_box.tabIndex = 8;
  11. zip_box.tabIndex = 9;
  12. ccomments_box.tabIndex = 10;
  13.  
  14. send_btn.onRelease = function() {
  15. my_vars = new LoadVars();
  16. my_vars.cname = name_box.text;
  17. my_vars.cphone = phone_box.text;
  18. my_vars.csubject = subject_box.text;
  19. my_vars.csender = email_box.text;
  20. my_vars.cstreet = street_box.text;
  21. my_vars.cpo = po_box.text;
  22. my_vars.ccity = city_box.text;
  23. my_vars.cstate = state_box.text;
  24. my_vars.czip = zip_box.text;
  25. my_vars.ccomments = ccomments_box.text;
  26. if (my_vars.csender != "" and my_vars.csubject != "" and my_vars.ccomments != ""and my_vars.cstate != "" and my_vars.czip != "") {
  27. my_vars.sendAndLoad("mailer.php", my_vars, "POST");
  28. gotoAndStop("success");
  29. } else {
  30. error_clip.gotoAndPlay("success");
  31. }
  32. my_vars.onLoad = function() {
  33. gotoAndStop("fail");
  34. };
  35. };
  36. email_box.onSetFocus=csubject_box.onSetFocus=cmessage_box.onSetFocus=function () {
  37. if (error_clip._currentframe != 1) {
  38. error_clip.gotoAndPlay(6);
  39. }
  40. };
  41. /*email_box.onSetFocus = subject_box.onSetFocus=message_box.onSetFocus=function () {
  42. if (error_clip._currentframe != 1) {
  43. error_clip.gotoAndPlay(6);
  44. }
  45. };
  46. */


and this is the code on the php side

  1. <?php
  2. /* ---------------------------
  3. php and flash contact form.
  4. by www.MacromediaHelp.com
  5. ---------------------------
  6. Note: most servers require that one of the emails (sender or receiver) to be an email hosted by same server,
  7. so make sure your email (on last line of this file) is one hosted on same server.
  8. --------------------------- */
  9.  
  10. // read the variables form the string, (this is not needed with some servers).
  11. $csubject = $_REQUEST["subject"];
  12. $cname = $_REQUEST["name"];
  13. $cphone = $_REQUEST["phone"];
  14. $cstreet = $_REQUEST["street"];
  15. $cpo = $_REQUEST["po"];
  16. $ccity = $_REQUEST["city"];
  17. $cstate = $_REQUEST["state"];
  18. $czip = $_REQUEST["zip"];
  19. $ccomments = $_REQUEST["ccomments"];
  20. $csender = $_REQUEST["sender"];
  21.  
  22. // include sender IP in the message.
  23. $full_message = $_SERVER['REMOTE_ADDR'] . "\n\n" . $ccomments . "\n\n" . $cname . "\n\n" . $cphone . "\n\n" . $cstreet . "\n\n" . $cpo . "\n\n" . $ccity . "\n\n" . $cstate . "\n\n" . $czip;
  24. $message= $full_message;
  25. // remove the backslashes that normally appears when entering " or '
  26. $message = stripslashes($message);
  27. $subject = stripslashes($csubject);
  28. $sender = stripslashes($csender);
  29.  
  30.  
  31.  
  32. // add a prefix in the subject line so that you know the email was sent by online form
  33. $subject = "Contact form ". $subject;
  34. // send the email, make sure you replace email@yourserver.com with your email address
  35. if(isset($message) and isset($subject) and isset($sender)){
  36. mail("administrator@gnci.net", $subject, $message, "From: $sender");
  37. }
  38. ?>

and this is the email that I get
------------------------------------------------------
Sent: Tuesday, October 30, 2007 2:10 AM
To: Administrator
Subject: Contact form

10.1.10.131

comments3
--------------------------------------------------
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 52
Reputation: JeniF is an unknown quantity at this point 
Solved Threads: 5
JeniF's Avatar
JeniF JeniF is offline Offline
Junior Poster in Training

Re: mailer.php almost works :|

 
0
  #2
Nov 7th, 2007
try placing the variables in single quotes like this:

$full_message = $_SERVER['REMOTE_ADDR'] . "\n\n" . '$ccomments '. "\n\n" . '$cname' . "\n\n" . '$cphone' . "\n\n" . '$cstreet' . "\n\n" . '$cpo' . "\n\n" . '$ccity' . "\n\n" . '$cstate' . "\n\n" .' $czip'
I keep hitting "escape", but I'm still here!!!!
:}
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 271
Reputation: fatihpiristine has a little shameless behaviour in the past 
Solved Threads: 16
fatihpiristine's Avatar
fatihpiristine fatihpiristine is offline Offline
Posting Whiz in Training

Re: mailer.php almost works :|

 
0
  #3
Nov 7th, 2007
i added the full code, check it over... and checks smtp server also
Attached Files
File Type: zip mail.zip (5.5 KB, 107 views)
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC