A
Anonymous
Guest
Hi all
I'll try simplify my problem as much as I can so you can understand me. I have a form that takes the users input & puts it into a mysql DB, 1 of the fields in the form is a dropdown menu containing names that are being taken from a table in the DB.
My form is submitted to a file called process.php, here is my process.php file
What I want to do is get the value of "$_POST['dir']" & email the address that corresponds to that variable in my managers table.
Example, if I have bob as a user & bob@bob.com in my managers DB & a user selects the name bob in the form, I want something mailed to bob's email which is bob@bob.com.
Thanks in advance for any replies, all input & suggestions welcome :wink:
I'll try simplify my problem as much as I can so you can understand me. I have a form that takes the users input & puts it into a mysql DB, 1 of the fields in the form is a dropdown menu containing names that are being taken from a table in the DB.
My form is submitted to a file called process.php, here is my process.php file
Code:
<?php
include("config.php");
$dbh = mysql_connect ($dbhost, $dbuname, $dbpass) or die ( 'I cannot connect to the database because: ' . mysql_error());
mysql_select_db ($dbname) or die (mysql_error());
$result = mysql_query ("INSERT INTO travel (prn, date, name, dir, purpose, sponsor, refund, what_refundable, flight_cost, subsis_cost, no_nights, depart_location, depart_time, out_flight, via_location, via_arrive, via_depart, arrive_location, arrive_time, arrive_flight, return_location, return_time, return_flight, via_location2, via_arrive2, via_depart2, depart_time2, arrive_time2, flight_num2, uname) values ('".$_POST['prn']."','".$_POST['date']."','".$_POST['name']."','".$_POST['dir']."',
'".$_POST['purpose']."','".$_POST['sponsor']."','".$_POST['refund']."',
'".$_POST['what_refundable']."','".$_POST['flight_cost']."',
'".$_POST['subsis_cost']."','".$_POST['no_nights']."',
'".$_POST['depart_location']."','".$_POST['depart_time']."',
'".$_POST['out_flight']."','".$_POST['via_location']."','".$_POST['via_arrive']."',
'".$_POST['via_depart']."','".$_POST['arrive_location']."',
'".$_POST['arrive_time']."','".$_POST['arrive_flight']."',
'".$_POST['return_location']."','".$_POST['return_time']."',
'".$_POST['return_flight']."','".$_POST['via_location2']."',
'".$_POST['via_arrive2']."','".$_POST['via_depart2']."',
'".$_POST['depart_time2']."','".$_POST['arrive_time2']."',
'".$_POST['flight_num2']."','".$_POST['uname']."')", $dbh);
$result = mysql_query ("select id, name, email from managers");
while ($row = mysql_fetch_array($result)) {
if ($dir = $name);
echo "$email";
mail ("$email", "test", "content", "test");
}
?>
Example, if I have bob as a user & bob@bob.com in my managers DB & a user selects the name bob in the form, I want something mailed to bob's email which is bob@bob.com.
Thanks in advance for any replies, all input & suggestions welcome :wink: