midgar777 Posted July 13, 2008 Share Posted July 13, 2008 Hello everyone at phpFreaks, I'm working on a simple form that emails the form data to an email address. I have this working with the following code <?php $email = $_REQUEST['email'] ; $name = $_REQUEST['name'] ; $country = $_REQUEST['country'] ; mail( "[email protected]", "New Mailing List Subscriber!", $country, "From: $email" ); header( "Location: http://www.myspace.com/mercurialuk" ); ?> i removed my real email address to avoid spam but in the real thing i have my email this [email protected] is just for this post and the email output is: japan lol! I can see how it is doing this but the problem is, I want the email to be a little more detailed so how would i replace the $country to reflect something like: $name from $country wants to join your mailing list! Their email is $email Any ideas guys im really stuck with this ¬_¬ The closest i got is using '.' to add them together like this $name . $email . $country but that gave me an email that was [email protected] ?? Thanks in advance! Pete Link to comment https://forums.phpfreaks.com/topic/114519-new-to-php-please-help/ Share on other sites More sharing options...
wildteen88 Posted July 13, 2008 Share Posted July 13, 2008 Do it as $message = "$name from $country wants to join your mailing list! Their email is $email"; mail( "[email protected]", "New Mailing List Subscriber!", $message, "From: $email" ); Link to comment https://forums.phpfreaks.com/topic/114519-new-to-php-please-help/#findComment-588887 Share on other sites More sharing options...
midgar777 Posted July 13, 2008 Author Share Posted July 13, 2008 Works a treat thanks! I had a feeling it would be something simple but when you are unfamiliar with php and its syntax then its a little hard! Thanks so much though you are a legend good sir! Link to comment https://forums.phpfreaks.com/topic/114519-new-to-php-please-help/#findComment-588893 Share on other sites More sharing options...
bothwell Posted July 13, 2008 Share Posted July 13, 2008 You can only use specific parameters inside mail(); Use an additional variable to hold your custom ones instead, so something like this: $email = $_REQUEST['email'] ; $name = $_REQUEST['name'] ; $country = $_REQUEST['country'] ; $msg .= $name; $msg .= " from "; $msg .= $country; $msg .= " wants to join your mailing list Their email is: "; $msg .= $email; mail( "[email protected]", "New Mailing List Subscriber!", $msg, "From: $email" ); Edit: Posted at the same time as Wildteen - his version's more visually compact and tidier Link to comment https://forums.phpfreaks.com/topic/114519-new-to-php-please-help/#findComment-588894 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.