dannau Posted July 30, 2007 Share Posted July 30, 2007 Dear all, I'm a beginner in PHP coding. I´ve made a form that connects to a Mysql database and an echo function of all the inormation. I'm tyrying to include a mail function that sends all the variables on our email address. It works flawlessly when I use only one variable, but is stuck with a T_variable message when I use more than one variable: This is the code as I have it now: $message = "Recu informations qualité de "$nom" pour le voyage effectué en "$mois" "$annee". \n\n Contact: "$contact", \n Supports: ".$supports.", \n Logements: "$logements", \n Circuit: "$circuit", \n Excursions: "$excursions", \n Guides: "$guides", \n Repas: "$repas", \n Transports: "$transports", \n Note: "$note", \n Commentaire: "$commentaire; mail('my [email protected]', 'Retour de Questionnaire Qualite',$message); This is probably a very basic and stupid mistake (I hope) but I have been working on this for a whole day. Thanks, Mark (Mantagua, Chile) Link to comment https://forums.phpfreaks.com/topic/62486-solved-mail-function-with-multiple-variables/ Share on other sites More sharing options...
suttercain Posted July 30, 2007 Share Posted July 30, 2007 Your error is here: "$logements", \n Circuit: "$circuit", You need to concatenate there try this : $message = "Recu informations qualité de " .$nom. " pour le voyage effectué en " .$mois. " " .$annee. ". \n\n Contact: " .$contact. ", \n Supports: " .$supports. ", \n Logements: " .$logements. ", \n Circuit: ". $circuit. ", \n Excursions: " .$excursions. ", \n Guides: " .$guides. ", \n Repas: " .$repas. ", \n Transports: " .$transports. ", \n Note: " .$note. ", \n Commentaire: " .$commentaire. ""; Or if you want the quotes to appear around the variables, preceed them with a backslah... example qualité de \"$nom\" Link to comment https://forums.phpfreaks.com/topic/62486-solved-mail-function-with-multiple-variables/#findComment-310994 Share on other sites More sharing options...
dannau Posted July 30, 2007 Author Share Posted July 30, 2007 Thank you Suttercain. I tried the new code and I still get the same message: Parse error: syntax error, unexpected T_VARIABLE in /home/dannau/public_html/qual/insert.php on line 41 Mark (Mantagua Chile) Link to comment https://forums.phpfreaks.com/topic/62486-solved-mail-function-with-multiple-variables/#findComment-311022 Share on other sites More sharing options...
dannau Posted July 30, 2007 Author Share Posted July 30, 2007 I'm very proud of myself because I found the solution on my own. I've started using snippets of the message and they would all work separately. That's until I added the part where two variables are one behind the other. I just added a short word in between and it works. Before: $message = "Recu informations qualité de " .$nom. " pour le voyage effectué en " .$mois. " " .$annee. ". \n\n Contact: " .$contact. ", \n Supports: " .$supports. ", \n Logements: " .$logements. ", \n Circuit: ". $circuit. ", \n Excursions: " .$excursions. ", \n Guides: " .$guides. ", \n Repas: " .$repas. ", \n Transports: " .$transports. ", \n Note: " .$note. ", \n Commentaire: " .$commentaire. ""; After: $message = "Recu informations qualité de " .$nom. " pour le voyage effectué en " .$mois. " de " .$annee. ". \n\n Contact: " .$contact. ", \n Supports: " .$supports. ", \n Logements: " .$logements. ", \n Circuit: ". $circuit. ", \n Excursions: " .$excursions. ", \n Guides: " .$guides. ", \n Repas: " .$repas. ", \n Transports: " .$transports. ", \n Note: " .$note. ", \n Commentaire: " .$commentaire. ""; Does someone send me a chocolate medal now? Cheers, Mark Link to comment https://forums.phpfreaks.com/topic/62486-solved-mail-function-with-multiple-variables/#findComment-311077 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.