Hi guys,
I've created a simple php form and am trying to get it to return empty fields to me for the email here's what ive got.
<?php
if(isset($_POST))
{
$name = check_input($_POST['form2mail_name']);
$email = check_input($_POST['form2mail_email'], "Enter an email address please");
$telp = check_input($_POST['form2mail_tel']);
$address = check_input($_POST['texform2mail_address']);
$nature = check_input($_POST['form2mail_nature_of_interest']);
$thickness = check_input($_POST['form2mail_thickness']);
$projectName = check_input($_POST['form2mail_project_name']);
$sample = check_input($_POST['form2mail_samples']);
//process sent message
$to = 'danny@getextra.co.uk';
$subject = 'Reqeust Info parapan.co.uk';
$message = "Name : " . $name ."\n" ;
$message .= "Address : " . $address ."\n" ;
$message .= "Nature : " . $nature ."\n" ;
$message .= "Thickness : " . $thickness ."\n" ;
$message .= "Project Name : " . $projectName ."\n" ;
$message .= "Sample : " . $sample ."\n" ;
$header = "Form : " . $email;
$sentmail = mail($to, $subject, $message, $header);
if($sentmail) {
header('Location: http://79.170.44.86/parapan.co.uk/colours/index.html');
}
}
?>
<? php
function check_input($data, $problem='')
{
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
if ($problem && strlen($data) == 0)
{
die($problem);
}
return $data;
}
?>