Hi Guys,
im new to php.
Im getting a error on my thank_you.php page and getting this messsage.
Server Error
500 - Internal server error.
There is a problem with the resource you are looking for, and it cannot be displayed.
Its seems the php code making this error
the php code is
<?php
if($_POST){
//an array of the fields that are allowed to be sent.
$allowed_fields = array(
"name",
"company",
"tel",
"email",
"message");
$msg = "This is a message sent via Cam website<br /><br />";
$msg .= '<table width="500" border="0">';
//loop through all the posts, $key is name of field, $value is
data entered
foreach($_POST as $key => $value){
//check this is an allowed field
if(in_array($key,$allowed_fields)){
$msg .= '<tr><td width="50%" style="background-color:
"#CCCCCC" valign="top">'
.preg_replace("/([A-Z])/"," $1",$key).'</td>';
$msg .= '<td style="background-color: "#DDDDDD"
valign="top">'.nl2br($value).'</td></tr>';
}
}
$msg .= "</table>";
$to = "richard@email.co.uk";
$subject = "Contact Form";
$headers = 'MIME-Version: 1.0' ;
$headers .= 'Content-type: text/html; charset=iso-8859-1';
if(in_string("http://", strtolower($_POST['comment']), 1))
{
header('Location: notsentcoment.php');
}
else
{
mail($to, $subject, $msg, $headers);
}
}
function in_string($needle, $haystack, $insensitive = 0) {
if ($insensitive) {
return (false !== stristr($haystack, $needle)) ? true : false;
} else {
return (false !== strpos($haystack, $needle)) ? true : false;
}
}
?>
No comments:
Post a Comment