Jump to content

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/88623-php-form-wont-send/
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/88623-php-form-wont-send/#findComment-453975
Share on other sites

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. :P

Link to comment
https://forums.phpfreaks.com/topic/88623-php-form-wont-send/#findComment-453990
Share on other sites

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);

 

 

?>

Link to comment
https://forums.phpfreaks.com/topic/88623-php-form-wont-send/#findComment-454007
Share on other sites

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? :-(

Link to comment
https://forums.phpfreaks.com/topic/88623-php-form-wont-send/#findComment-454023
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.