grucker Posted November 2, 2012 Report Posted November 2, 2012 I have a few forms that send to a database and then I pull the information posted to a web page. I have many forms that send an email message. How is it possible to send one form to both database and email. Regards David Quote
Wickham Posted November 2, 2012 Report Posted November 2, 2012 Essentially, you just have to add the mail function last, after the submission to your database. See if you can work it out from here to suit your code:- $result=MYSQL_QUERY("INSERT INTO villagehall (id, day, month, year,date,starttime, endtime, club, room, who, phone, email, message, book)". "VALUES ('NULL', '$day', '$month', '$year', '$date', '$starttime', '$endtime', '$club1', '$room' , '$who1', '$phone1' , '$email1' , '$message1', '$book')")or die( "<p><span style=\"color: red;\">Unable to select table</span></p>"); mysql_close(); mail( $email, "Village Hall booking", "$day/$month/$year $starttime to $endtime\r\n$room $book\r\n$club\r\n\r\n$replymsg", "From: $admin" ); header( "Location: $thankyouurl" ); } ?> The above is just part of the code. It's old mysql; I have updated my page to mysqli which is recommended now, but the code is a little bit more complicated as more than one parameter is often needed. Quote
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.
Note: Your post will require moderator approval before it will be visible.