0){ // displaying error page include("requestform.err.inc.php"); }else{ $sql="INSERT INTO form (name, company, phone, email) VALUES ('".formfield_encode($name)."', '".formfield_encode($company)."', '".formfield_encode($telephone)."', '".formfield_encode($email)."')"; $result=mysql_query($sql) or die("query failed : ".$sql) ; $from = "info@emmaco.co.uk"; $subject = "Download at emmaco.co.uk"; $body = "Download at emmaco.co.uk"."
"; $body .= "The following information was provided."."
"."
"; $body .= ""; $body .= ""; $body .= ""; $body .= "
Name: ".$name."
Company: ".$company."
Telephone: ".$telephone."
Email: ".$_POST['email']."
"; $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; $headers .= "From: ".$from." <".$from.">\r\n"; mail("info@emmaco.co.uk", $subject, $body, $headers); if($result){ session_register("email"); session_register("session_id"); $_SESSION['email']=formfield_encode($email); $_SESSION['session_id']=session_id(); header("Location: realdownloads.php?id=".$_GET['id']); }else{ echo "Error: Please try again."; } } //if form is not submitted form first time page }else{ include("requestform.inc.php"); } ?>