Solution 1 :

The textbox for the email address is called mail.
You are checking if ’email’ isset and not ‘mail’.

Correct your php to the following:

if(isset($_POST['mail']) && !empty($_POST['mail'])){

Problem :

I am having issues with my form built is HTML and PHP. It is returning a white page after I clicked to submit. The website is online already http://diegodiasp.com/

The html is the following:

<form class="bg-light p-4 p-md-5 contact-form" action="./contactform.php" method="POST" >
							<div class="form-group">
								<input class="form-control" name="name"  placeholder="Your Name">
							</div>
							<div class="form-group">
								<input class="form-control" name="mail"  placeholder="Your Email">
							</div>
							
							<div class="form-group">
								<textarea class="form-control" name="message"  cols="30" rows="7" placeholder="Message"></textarea>
							</div>
							<div class="form-group">
								<input type="submit" value="Send Message" class="btn btn-primary py-3 px-5">
							</div>
						</form>

And the PHP is as bellow:

<?php  

if(isset($_POST['email']) && !empty($_POST['email'])){


    $name = addslashes($_POST['name']);   
    $email = addslashes($_POST['mail']);   
    $message = addslashes($_POST['message']);  

    $to = "[email protected]";
    $subject = "Contact - Diego Dias Front End";
        $body = "Name: ".$name."rn".
        "Email: ".$email."rn".
        "Message: ".$message;
    $header = "From:[email protected]"."rn"."Reply-To:".$email."rn"."X=Mailer:PHP/".phpversion();

    if(mail($to,$subject,$body,$header)){
        echo("Email succesfully sent!");

    }else{
        echo("Email not sent!");

    }

}

?>

Comments

Comment posted by Jeto

A common cause for a blank page is an unrecoverable (fatal) PHP error occurring. On a production environment, you’ll have to check your webserver’s logs to see what error occurred.

By