<?php
$error="";$successMessage="";
if($_POST) {
$error="";
if(!$_POST("email"))
{
$error .="An email address is required<br>";
}//code works fine till here
//from here on the code gets printed on screen and is not working
if(!$_POST("content")){
$error.="The content field is required<br>";
}
if(!$_POST("subject")){
$error.="The subject is required<br>";
}
if ($_Post['email'] && filter_var($_POST("email"), FILTER_VALIDATE_EMAIL)===false) {
$error .="$email is not a valid email address. <br>";
}
if($error !==""){
$error='<div class="alert alert-danger" role="alert"><p><strong>There were error(s) in your form</strong></p>'. error . '</div>';
}
else
{
$emailTo="vibhorvimal5598@gmail.com";
$subject=$_POST("subject");
$content=$_POST("content");
$headers="From:"$_POST('email');
if(mail($emailTo,$subject,$content,$headers)){
$successMessage='<div class="alert alert-danger" role="alert"><p><strong>Your message was sent</strong></p>'. error . '</div>';
}
}
?>
what is wrong in this code can anyone please explain because I already checked for the syntax and error and all . I don't know what is wrong and why this is happening. Can anyone please help me out and tell why the code is not working correctly after first if statement