php code is not changing the header -
this question has answer here:
- how fix “headers sent” error in php 11 answers
it giving me , not changing header:
warning: cannot modify header information - headers sent (output started @ /home/content/27/10711827/html/contact.php:2) in /home/content/27/10711827/html/contact.php on line 24
here code.
<?php if (empty($_post) === false){ $errors = array(); $name = $_post['name']; $email = $_post['email']; $message = $_post['message']; if (empty($name) === true || empty($email) === true || empty($message) === true){ $error[] = 'name, email , message required!'; } else{ if (filter_var($email, filter_validate_email) === false){ $errors[] = 'that\'s not valid email address'; } if (ctype_alpha($name) === false){ $errors[] = 'name must cotain letters'; } } if(empty($errors) === true){ mail('houseblendrecords@gmail.com', 'contact form', '$message', 'from: ' . $email); header('location: contact.php?sent'); exit(); } }
this happens when code has produced content time you're trying send header. make sure code isn't producing warnings. if you're sure that's not case, make sure there aren't empty lines before opening <?php tag.
Comments
Post a Comment