Home » Php » php – display a blank page after submit

php – display a blank page after submit

Posted by: admin February 25, 2020 Leave a comment



<!DOCTYPE html>
<html lang="en">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>


<form  action="check.php" method="post">
<input type="text" name="name" id="name" placeholder="first name">
<input type="text" name="email" id="email">
<button type="submit" name="submit" id="dsubmit">submit</button>
<p class="form-message"></p>


check.php file



    $name = $_POST['name'];
    $mail = $_POST['mail'];

    echo "name is " .$name;


after i submit it redirects to the check.php file but it displays nothing on that page.
so i changed check.php file to this

    $name = $_POST['name'];
    $mail = $_POST['mail'];

     echo "name is " .$name;


this display Undefined index: name and Undefined index: mail

How to&Answers: