<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>  </title>

</head>

<body>
<?
$page
= "http://ella.slis.indiana.edu/~arsteven/form/form.html";
      if (!
ereg($page, $_SERVER['HTTP_REFERER'])){
         echo
"Invalid referer";
         die;
         }

        

//import form information
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$types=$_POST['types'];
$message=stripslashes($message);


/*
Simple form validation
check to see if an email and message were entered
*/
//if no message entered and no email entered print an error  
if (empty($message) && empty($email)){
  print
"No email address and no message was entered. <br>Please include an email and a message";
  }
   
//if no message entered send print an error  
  
elseif (empty($message)){
  print
"No message was entered.<br>Please include a message.<br>";
  }
  
//if no email entered send print an error  
elseif (empty($email)){
  print
"No email address was entered.<br>Please include your email. <br>";
  }

  
//if the form has both an email and a message
  
else {




// print a response message


//Thank the user by name if they entered a name
if (!empty($name)) {
  print
"<b>Thank you $name.</b><br>";
}


for (
$i=0;$i<count($types);$i++){
  
$ctypes=  $ctypes . "\n$types[$i]";
  
$screen_ctypes=  $screen_ctypes . "\n$types[$i]";
}

print
"<p><b>The following message has been sent</b>: <br>$message<br></p><p><b>Comment type(s):</b><br>$screen_ctypes</p>";
$body= $message . " \n\nComment type(s)" . $ctypes;


//mail the form contents
mail( "your-email@indiana.edu", "Web site comments", $body, "From: $email" );



  
  
  }




?>


</body>
</html>