Hello I have a php contact email form on my a ecommerce shop website !
I am getting a Undefined index error messages coming from the top of the php code, the email form its self works fine,
HERE IS THE ERROR MESSAGES
Notice: Undefined index: Name in E:\domains\t\to ols2diy.co.uk\u ser\htdocs\cont act.php on line 13
Notice: Undefined index: Tel in E:\domains\t\to ols2diy.co.uk\u ser\htdocs\cont act.php on line 14
Notice: Undefined index: Email in E:\domains\t\to ols2diy.co.uk\u ser\htdocs\cont act.php on line 15
Notice: Undefined index: Message in E:\domains\t\to ols2diy.co.uk\u ser\htdocs\cont act.php on line 16
The code im using is as follows :
The strange thing is that im using the exact same code in another site which is hosted on another server ! but its error free and my current hosting have told me its not the hosting so im stuck !
Any help would be great
I am getting a Undefined index error messages coming from the top of the php code, the email form its self works fine,
HERE IS THE ERROR MESSAGES
Notice: Undefined index: Name in E:\domains\t\to ols2diy.co.uk\u ser\htdocs\cont act.php on line 13
Notice: Undefined index: Tel in E:\domains\t\to ols2diy.co.uk\u ser\htdocs\cont act.php on line 14
Notice: Undefined index: Email in E:\domains\t\to ols2diy.co.uk\u ser\htdocs\cont act.php on line 15
Notice: Undefined index: Message in E:\domains\t\to ols2diy.co.uk\u ser\htdocs\cont act.php on line 16
The code im using is as follows :
Code:
<?php
session_cache_limiter('none');
session_start();
ob_start();
?>
<?php
$EmailFrom = "info@mediadiverse.org.uk";
$EmailTo = "info@mediadiverse.org.uk";
$Subject = "Tools2diy Enquiry";
$Name = Trim(stripslashes($_POST['Name']));
$Tel = Trim(stripslashes($_POST['Tel']));
$Email = Trim(stripslashes($_POST['Email']));
$Message = Trim(stripslashes($_POST['Message']));
// validation
if (isset($_POST['submit'])) $validate = validateform($Name, $Tel, $Email, $Message);
// prepare email body text
$Body = "";
$Body .= "Name: ";
$Body .= $Name;
$Body .= "\n";
$Body .= "Tel: ";
$Body .= $Tel;
$Body .= "\n";
$Body .= "Email: ";
$Body .= $Email;
$Body .= "\n";
$Body .= "Message: ";
$Body .= $Message;
$Body .= "\n";
// send email
if (isset($_POST['submit']) && $validate['false'] != true){
mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");
$emailsent = true;
}
function validateform($Name, $Tel, $Email, $Message){
//Check empty fields
if ($Name == ''){
$return['false'] = true;
$return['nameblank'] = true;
}
if ($Tel == ''){
$return['false'] = true;
$return['telblank'] = true;
}
if ($Email == ''){
$return['false'] = true;
$return['emailblank'] = true;
}
if ($Message == ''){
$return['false'] = true;
$return['messageblank'] = true;
}
//Check phone number is digits and spaces only
if (!is_numeric(str_replace(' ','',$Tel))){
$return['phone'] = true;
$return['false'] = true;
}
//Check email is valid
if (!preg_match('/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/',$Email)){
$return['email'] = true;
$return['false'] = true;
}
//CAPTCHA
if($_POST['secure'] != $_SESSION['security_number']){
$return['captcha'] = true;
$return['false'] = true;
}
return $return;
}
?>
The strange thing is that im using the exact same code in another site which is hosted on another server ! but its error free and my current hosting have told me its not the hosting so im stuck !
Any help would be great
Comment