ive got a problem with the following code, basically i call some variables from a previous page and send them in an email as well as the form that has been filled in.
If i print the variables on the web page it works, but when i try and put them in an email it stops working. The weird thing is that this was working couple of days ago. Any ideas?
<?php
$db_name = "web";
$table_name = "jobs";
$connection = @mysql_connect("dfdf", "web", "r2dpo") or die(mysql_error());
$db = @mysql_select_db($db_name, $connection) or die(mysql_error());
$job_id = $_GET['job_id'];
$query = "select * from jobs where job_id = '$job_id';";
$result = mysql_query($query) or die(mysql_error());
while ($row = mysql_fetch_array($result))
{
$job_id = $row['job_id'];
$contact_name = stripslashes($row['contact_name']);
$contact_phone = $row['contact_phone'];
$date_posted = $row['date_posted'];
$job_title = stripslashes($row['job_title']);
$job_summary = stripslashes($row['job_summary']);
$location = stripslashes($row['location']);
$job_status = stripslashes($row['job_status']);
$salary = $row['salary'];
$career_level = stripslashes($row['career_level']);
}
// Check to see if the form has been submitted (by checking the hidden form field $form_complete
if ($_REQUEST['form_complete']) {
// Include the class
include("./validator-class.php");
// Initiate a new instance of the class
$my_form = new validator;
// Check to see if the form fields have valid data
// Please check the README.txt file for more info...
if ($my_form->validate_fields("to_address, your_email")) {
// The form validated
echo "The job has been sent $to_address\n";
$msg = "$message\n\n";
$msg .= "Type: $job_status\n";
$msg .= "Job title: $job_title\n";
$msg .= "$job_summary\n";
$msg .= "Location: $location\n";
$msg .= "Salary: $salary\n";
$msg .= "Contact: $contact_name\n";
$msg .= "Telephone: $contact_telephone\n";
$msg .= "Reference: TR $job_id\n";
$msg .= "Date posted: $date_posted\n";
$msg .= "This job was sent to you by: $your_email\n";
$msg .= "To apply for this position, please contact $contact_name on $contact_telephone.\n";
$msg .= "For more jobs please visit www.talentrecruit.com\n";
$from_header = "$your_email";
$to = "$to_address";
$subject = "$job_title";
mail($to, $subject, $msg,"From: $from_header\n");
echo "</table>\n";
echo "<p></p>\n";
echo "<br><br><br><br><br><br>\n";
echo "<table width=803 height=0 border=0 cellpadding=0 cellspacing=1>\n";
echo "<tr>\n";
echo "<td width=100 height=80><img src=images/eye.gif width=100 height=80></td>\n";
echo "<td width=100><img src=images/glass.gif width=100 height=80></td>\n";
echo "<td width=100><img src=images/thumb.gif width=100 height=80></td>\n";
echo "<td width=100><img src=images/tie.gif width=100 height=80></td>\n";
echo "<td width=396 align=center bgcolor=#333399>\n";
echo "<table width=389 border=0 cellspacing=0 cellpadding=0>\n";
echo "<tr>\n";
echo "<td align=center valign=middle> <p><b><strong></strong></b><font color=#FFFFFF size=1><b><strong>\n";
echo "Copyright ©2003 Talent Recruitment Ltd. All rights reserved.</strong></b></font></p></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td width=389> </td>\n";
echo "</tr>\n";
echo "</table></td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "<div align=left>\n";
echo "</div>\n";
echo "</body>\n";
echo "</html>";
exit;
} else {
// ERROR HANDLING can be done 2 ways
// [1] The form did NOT validate, so we can print the error message
// using either the english HTML formatted $obj->error...
print($my_form->error . "<br><br>");
// [2] ... OR, handle the error messaging by looping through the array
// of null fields returned by $this->error_array.
#print_r ($my_form->error_array['missing_fields']);
}
}
// Print the form
?>