I have found this code for redirecting my contact form through an index.php page, but it shows up with part of the code on the redirect page. The code looks okay to me, I don't know what I am missing. Here it is:
<html>
<head>
<style type= "text/css">
body {
background-color: #C2C2FF;
}
#holla {
width: 500px;
margin-left: auto;
margin-right: auto;
margin-top: 100px;
}
</style>
</head>
<body>
<div id= "holla">
<img src="smiley.png">
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$from = 'From: webpage';
$to = 'emailaddressblocked';
$subject = 'Hello';
$human = $_POST['human'];
$body = "From: $name\n E-Mail: $email\n Message:\n $message";
if ($_POST['submit'] && $human == '4') {
if (mail ($to, $subject, $body, $from)) {
echo '<p>Your message has been sent!</p>';
} else {
echo '<p>Something went wrong, go back and try again!</p>';
} else if ($_POST['submit'] && $human != '4') {
echo '<p>You answered the anti-spam question incorrectly!</p>';
}
}
?>
</div>
</body>
</html>