session_start(); php help for my websites contact page.?

Hey, I'm trying to create a contact page for my website for a web design class I'm taking. Problem is I'm trying to get my session_start() code to work but I can't. I fixed the "warning error" that pops up, but now when I hit send, my controller page is just blank and doesn't say "Thanks your message has been sent" or "Sorry, please fix this...". I'm going to post my code, I've been trying to find any problems, but I'm not sure, I've been puting this code before the <!DOCTYPE> tag. Also my site is "justin88.com", nothing special, just for a class.

<?php
session_start();
if ($_POST['action'] =='Send') {

$errors = array();
if($_SESSION['security_code'] != $_POST['cap_code'] && !empty($_SESSION['security_code'])) {
$errors['security'] = 'Sorry, your entered security code does not match the security image.';
}
$errors = array();
if(empty($_POST['firstname'])){
$errors['firstname'] = 'You must provide a first name';
}
$errors = array();
if(empty($_POST['lastname'])){
$errors['lastname'] = 'You must provide a last name';
}
$errors = array();
if(empty($_POST['email'])){
$errors['email'] = 'You must provide an email';
}
$errors = array();
if(empty($_POST['subject'])){
$errors['subject'] = 'You must provide a subject';
}
$errors = array();
if(empty($_POST['message'])){
$errors['message'] = 'You must provide a message';
}
//deal with errors
if(!empty ($errors)){
include 'contact.php';
exit;
} else {
$to = '(Email here, Taken out for security reasons)';
$from = 'From:'.$_POST['email'];
$subject = $_POST['subject'];
$message = $_POST['message'];
$name = $_POST['firstname']." ". $_POST['lastname'];
$message .= $name;

mail($to, $subject, $message, $from);
$success = 'Thanks, your message has be sent.';
include 'contact.php';
exit;
}

}
?>

Like I said this is before the <!DOCTYPE> tag, which pretty much has the header and CSS references. Thanks for any help, this is due tomorrow, but anyhelp after would still be ok.
 
Back
Top