I cannot figure out at all why the php here is not sending a simple variable over to the IF statement. I tried echoing the $to_who variable in the IF statement, however it comes up as nothing. As a result, the INSERT statement is inserting nothing for the first column. The $to_who var has a number until the IF statement.
$to_who = $_GET['id'];
require('connect.php');
echo $to_who;
$to_who_search = "SELECT * FROM donorstable WHERE donor_id = '$to_who'";
$to_who_raw = mysql_query($to_who_search);
$name = mysql_result($to_who_raw , 0 , 'first_name') . ' ' . mysql_result($to_who_raw , 0 , 'last_name') ;
$email = mysql_result($to_who_raw , 0 , 'email');
if(isset($_POST['submit1'])){
require('connect.php');
//gets from data
$getsubject = $_POST['subject'];
$getmessage = $_POST['message'];
//Gets user's email from table
$getformsql = "SELECT * FROM donorstable WHERE donor_id = '$userid'";
$getfrom = mysql_query($getformsql);
//builds email
$to = $email;
$subject = $getsubject;
$message = $getmessage;
$from = mysql_result($getfrom , 0 , 'email');
$headers = "From:" . $from;
//mail($to,$subject,$message,$headers);
echo "Mail Sent.";
$inserstatement = "INSERT INTO messages VALUES ('$to_who' , '$from' ,'$subject', '$message' , '0' , '')";
mysql_query($inserstatement);
}
Thanks