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

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 class="form-group">
								<input class="form-control" name="mail"  placeholder="Your Email">
							<div class="form-group">
								<textarea class="form-control" name="message"  cols="30" rows="7" placeholder="Message"></textarea>
							<div class="form-group">
								<input type="submit" value="Send Message" class="btn btn-primary py-3 px-5">

And the PHP is as bellow:


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();

        echo("Email succesfully sent!");

        echo("Email not sent!");





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.