nadz Posted July 6, 2007 Share Posted July 6, 2007 basically i have a form on my page that the users fill out. i would like all the details submitted to the form to be emailed to the user. there are four fields and id like the email to look like this: Your name: Your details 1: Your details 2: Your details 3: i have the form ready and at the moment it stores the details in a mysql database, but id like to change it to email everything to the user instead. any help would be appreciated. Quote Link to comment Share on other sites More sharing options...
soycharliente Posted July 6, 2007 Share Posted July 6, 2007 Use the search function on this forum or on www.php.net and look for the mail function. It's been talked about probably 100 times here Do some research and if you run into any problems, come back and we can help you through it. There are a ton of ways to e-mail things so if you're asking for someone to write it for you, there is another forum for that as well. Quote Link to comment Share on other sites More sharing options...
steelmanronald06 Posted July 6, 2007 Share Posted July 6, 2007 Try This: http://lampgeekz.netgeekz.net/forum/index.php?topic=38.0 Quote Link to comment Share on other sites More sharing options...
nadz Posted July 6, 2007 Author Share Posted July 6, 2007 sorry i didnt explain myself properly, i know how to use the mail function and ive got it all set up but im having trouble displaying any of the details from the form and database. the email that the message is sent to is fetched from the database using a supplied id number to find it. for example, http://site.com/page.php?id=32 will email the message to the address of the user with id 32. $fetch=mysql_fetch_assoc(mysql_query("SELECT `email` FROM `crush2` WHERE `id`='$id'")); $email = $fetch['email']; if(mail ($email, $emailsubject, $body, "From: your site <crushreply@****.co.uk>")) include("crush/done.php"); my problem is that it doesnt email it to the address it grabs, in fact it doesnt fetch the address. can anyone see any errors in my code. Quote Link to comment Share on other sites More sharing options...
per1os Posted July 6, 2007 Share Posted July 6, 2007 Are you sure $id contains a value. If it is coming from get I would suggest adding this: $id = isset($_GET['id'])?$_GET['id']:0; if ($id > 0) { $fetch=mysql_fetch_assoc(mysql_query("SELECT `email` FROM `crush2` WHERE `id`='$id'")); $email = $fetch['email']; if(mail ($email, $emailsubject, $body, "From: your site <crushreply@****.co.uk>")) include("crush/done.php"); }else { echo 'invalid id'; } Quote Link to comment Share on other sites More sharing options...
nadz Posted July 7, 2007 Author Share Posted July 7, 2007 hi, i got it all sorted. the code was right i was pointing it to the wrong table thanks anyway Quote Link to comment 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.