alex99 Posted January 30, 2008 Share Posted January 30, 2008 Hi people. I found this snippet (whose auctor looks like he doesn't have a site/mail, or doesn't give any help for his own stuff), which is called from a flash form to send a mail: <? /* **************************************************************************** *** $msg se rapporte aux variables placées dans le corps du message *** **************************************************************************** */ $msg = "E-mail from site XXX \n\n"; /* ******************************************************************************************** *** La chaîne Nom Expediteur est écrite dans le corps du message suivi de la variable $nom_expediteur. Idem pour les autres valeurs. *** ******************************************************************************************** */ $msg .= "From sender: $nom_expediteur\n"; $msg .= "E-mail: $email_expediteur\n"; $msg .= "Subject: $sujet\n\n"; $msg .= "Message: $message\n\n"; /* ************************************************************* *** \n retourne à la ligne - \n\n saute une ligne *** ************************************************************* */ /* **************************************************** *** N'oubliez pas de mettre votre adresse email *** **************************************************** */ $to = "info@mysite.it"; $subject = "$sujet"; /* ***************************************************************** *** Ecrit "E-mail depuis mon site" dans le champs "from"*** ***************************************************************** */ $mailheaders = "E-mail from site XXX \n"; /* ***************************************************************** *** Ecrit l'e-mail de l'expéditeurdans le champs "Reply-To" *** ***************************************************************** */ $mailheaders .= "Reply-To: $email_expediteur\n\n"; /* ****************************************** *** Fonction Mail - exécute le script *** ****************************************** */ mail($to, $subject, $msg, $mailheaders); ?> But when I fill the flash form, and I hit the "send" button, I receive a mail with void fields: E-mail from site XXX Reply-To: (this is void) E-mail from site XXX From sender: (as above) E-mail: (void) Subject: (nothing) Message: Please can you tell me whether the problem is in this script? Thanks for your time. Quote Link to comment https://forums.phpfreaks.com/topic/88623-php-form-wont-send/ Share on other sites More sharing options...
nethnet Posted January 30, 2008 Share Posted January 30, 2008 Are the variables used to define the fields inside $msg even set anywhere? Most likely they are all empty to begin with... Is there another script that gives them values? Quote Link to comment https://forums.phpfreaks.com/topic/88623-php-form-wont-send/#findComment-453812 Share on other sites More sharing options...
alex99 Posted January 30, 2008 Author Share Posted January 30, 2008 Hi. Well, I'm sorry, I'm not sure to understand you. The script is called from inside a flash file. :-( It is there something I should check therein? Quote Link to comment https://forums.phpfreaks.com/topic/88623-php-form-wont-send/#findComment-453955 Share on other sites More sharing options...
env-justin Posted January 30, 2008 Share Posted January 30, 2008 can you post the action scripting from the flash file? Quote Link to comment https://forums.phpfreaks.com/topic/88623-php-form-wont-send/#findComment-453959 Share on other sites More sharing options...
alex99 Posted January 30, 2008 Author Share Posted January 30, 2008 Of course: it is here a box from which I could upload the zip? Quote Link to comment https://forums.phpfreaks.com/topic/88623-php-form-wont-send/#findComment-453964 Share on other sites More sharing options...
env-justin Posted January 30, 2008 Share Posted January 30, 2008 just post the actual script from the action script file Quote Link to comment https://forums.phpfreaks.com/topic/88623-php-form-wont-send/#findComment-453971 Share on other sites More sharing options...
alex99 Posted January 30, 2008 Author Share Posted January 30, 2008 The script is divided into several frames; anyway, here they are for the send button: on (press) { //quand l'utilisateur clique if (nom_expediteur ne "" and email_expediteur ne "" and message ne "") { //vérifie que l'utilisateur a rempli tous les champs i = "0"; validmail = 0; while (Number(i)<=Number(length(email_expediteur))) { if (substring(email_expediteur, i, 1) eq "@") { validmail = 1; } i = Number(i)+1; } //vérifie que l'e-mail fournie comporte bien un @ if (Number(validmail) == 0) { gotoAndStop("Contact", "invalide"); //si l'e-mail ne comporte pas d'@, //l'animation avance à l'étiquette "invalide", où l'on signale à l'utilisateur qu'il y a un problème } else { gotoAndPlay("Contact", "confirmation"); } //si tous les champs sont remplis (et que l'email fournie comporte un @) //l'animation se déplace à l'étiquette confirmation, où l'on montre son message à l'utilisateur pour confirmation } else { gotoAndStop("Contact", "invalide"); } } //si tous les champs déclarés nécessaires ne sont pas remplis, //l'animation avance à l'étiquette "invalide", où l'on signale à l'utilisateur qu'il y a un problème Please notice that pressing the button sends to another frame (which previously held another button, "are you sure to send this?".... hit that, and the mail is sent, in theory...), rather than submitting directly; the frame, that I modified in order to send directly the stuff ('cause the original one didn't sent anything; it simply stored the data from the box on the prime frame, showed to the user, then you hit the send, and that's all), has this action loadVariables("simple_emailformFR.php", "", "GET"); That's all for the actionscripts. It should be better if once I click the send, and the fields are all filled, it is directly sent, and taken to a "thank you" frame. Quote Link to comment https://forums.phpfreaks.com/topic/88623-php-form-wont-send/#findComment-453975 Share on other sites More sharing options...
env-justin Posted January 31, 2008 Share Posted January 31, 2008 the loadVariables function in flash i believe is used to get variables from an external file. it seems you are trying to do just the opposite. correct? if so you can use the LoadVars.send to send your form variables from you action script to your php file. http://www.actionscript.org/resources/articles/46/1/LoadVariables-and-LoadVars-Objects/Page1.html sorry if i misunderstood anything im not really a flash guy and the foreign language makes it a bit harder to understand the code fully. Quote Link to comment https://forums.phpfreaks.com/topic/88623-php-form-wont-send/#findComment-453990 Share on other sites More sharing options...
alex99 Posted January 31, 2008 Author Share Posted January 31, 2008 Hi env-justin. Well, I just leaved the GET method as it was in the original script; I didn't changed for the sake of some error of mine, eventually. Anyway, I tried changing as POST, but the problem persists. :-( Quote Link to comment https://forums.phpfreaks.com/topic/88623-php-form-wont-send/#findComment-453999 Share on other sites More sharing options...
env-justin Posted January 31, 2008 Share Posted January 31, 2008 Have you tried using $_GET['nom_expediteur'] register globals is probaly turned off at the start of your php script change all your variables coming from flash like so: $nom_expediteur = $_GET['nom_expediteur']; <? /* **************************************************************************** *** $msg se rapporte aux variables placées dans le corps du message *** **************************************************************************** */ $msg = "E-mail from site XXX \n\n"; /* ******************************************************************************************** *** La chaîne Nom Expediteur est écrite dans le corps du message suivi de la variable $nom_expediteur. Idem pour les autres valeurs. *** ******************************************************************************************** */ $nom_expediteur = $_GET['nom_expediteur']; $email_expediteur = $_GET['email_expediteur']; $sujet = $_GET['sujet']; $message = $_GET['message']; $msg .= "From sender: $nom_expediteur\n"; $msg .= "E-mail: $email_expediteur\n"; $msg .= "Subject: $sujet\n\n"; $msg .= "Message: $message\n\n"; /* ************************************************************* *** \n retourne à la ligne - \n\n saute une ligne *** ************************************************************* */ /* **************************************************** *** N'oubliez pas de mettre votre adresse email *** **************************************************** */ $to = "info@mysite.it"; $subject = "$sujet"; /* ***************************************************************** *** Ecrit "E-mail depuis mon site" dans le champs "from"*** ***************************************************************** */ $mailheaders = "E-mail from site XXX \n"; /* ***************************************************************** *** Ecrit l'e-mail de l'expéditeurdans le champs "Reply-To" *** ***************************************************************** */ $mailheaders .= "Reply-To: $email_expediteur\n\n"; /* ****************************************** *** Fonction Mail - exécute le script *** ****************************************** */ mail($to, $subject, $msg, $mailheaders); ?> Quote Link to comment https://forums.phpfreaks.com/topic/88623-php-form-wont-send/#findComment-454007 Share on other sites More sharing options...
alex99 Posted January 31, 2008 Author Share Posted January 31, 2008 Well, whilst I was waiting, I roamed to and fro, and found another fla+php and validation, and... this too outputs a blank result when I submit the form! What the hell is this? :-( p.s.: but for heaven's sake, but it is possible that I cannot find a simple fla+php that haves name+subject+mail+message, a validation, and hit-the-button-and-there-it-is? :-( Quote Link to comment https://forums.phpfreaks.com/topic/88623-php-form-wont-send/#findComment-454023 Share on other sites More sharing options...
env-justin Posted January 31, 2008 Share Posted January 31, 2008 did you try what i said to do the one last post. just add them 4 line at the top Quote Link to comment https://forums.phpfreaks.com/topic/88623-php-form-wont-send/#findComment-454029 Share on other sites More sharing options...
alex99 Posted January 31, 2008 Author Share Posted January 31, 2008 Well, I tried right now, upload the files via ftp, and once I put the url to the swf, I see a blank page! This is a truly damn night! Quote Link to comment https://forums.phpfreaks.com/topic/88623-php-form-wont-send/#findComment-454036 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.