adriscoll Posted March 13, 2011 Share Posted March 13, 2011 Hello. I have series of pages which connect form data and insert it into my database. When someone completes the form, they get an autoresponder with some variables of their signup included ($park & $firstname below). I would like to include some more detailed information regarding the event that is found in a different table called 'event'. I am not sure if it would take a join, or how to pass the variables. Can I just create a new SELECT statement and then pass the variables along? Any guidance would be great. <?php include('dbconfig.php'); $event_id = $_POST['event_id']; $park = $_POST['park']; $firstname = $_POST['firstname']; $lastname = $_POST['lastname']; $email = $_POST['email']; $phone = $_POST['phone']; $email_list = $_POST['email_list']; // Make a MySQL Connection mysql_connect("localhost", "$user", "$password") or die(mysql_error()); mysql_select_db("$database") or die(mysql_error()); mysql_query("INSERT INTO volunteer (id, event_id, park, firstname, lastname, email, phone, email_list) VALUES('', '$event_id', '$park', '$firstname', '$lastname', '$email', '$phone', '$email_list') ") or die(mysql_error()); ?> <?php $to = "$email"; $subject = "Trailworker Event Signup Confirmation"; $message = "Hello [b]$firstname[/b]! Thank you for signing up to work the [b]$park [/b] trailworker event. A crew leader will contact you shortly."; $from = "info@xxxxxxxxxx.com"; $headers = "From: $from"; mail($to,$subject,$message,$headers); echo "Thank you for signing up. You will receive an email shortly letting you know event details and who your crew leader is."; ?> Quote Link to comment Share on other sites More sharing options...
dragon_sa Posted March 13, 2011 Share Posted March 13, 2011 if you can do a SELECT query and get what you want at this stage based on any of the variables you have available then yes just do it that way and you will be able to use them in your email. If the information you want to add is already available from previous SELECT queries you could pass it along in a hidden form field, either way will work. Quote Link to comment Share on other sites More sharing options...
redarrow Posted March 13, 2011 Share Posted March 13, 2011 try this as a mail test mail.php <?php $to = 'add you email address here!'; $subject = 'Wakeup bob!'; $message = '<b>yo</b>, whassup?'; $headers = "From: server@example.com\r\n" . 'X-Mailer: PHP/' . phpversion() . "\r\n" . "MIME-Version: 1.0\r\n" . "Content-Type: text/html; charset=utf-8\r\n" . "Content-Transfer-Encoding: 8bit\r\n\r\n"; // Send mail($to, $subject, $message, $headers); ?> create a page called mail.php, add you email to the above code,see if it works. if it work use this code ok. I am not sure, but i think it the code you posted, No header info, Mail server's hate that. Also, had a quick look at your code, you need to valadate the info before entering the database. also all varables need . mysql_real_escape_string(['varable_name']) <<< around them. also you need to add at the bgining of you code. if(isset($_POST['submit])){ } good luck bro. 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.