All TalkersCode Topics

Follow TalkersCode On Social Media - A Social Media Network for developers Join Now ➔

Display HTML Form Values In Another Page After Submit

Last Updated : Jul 1, 2023

Display HTML Form Values In Another Page After Submit

In this tutorial we will show you the solution of display HTML form values in another page after submit, in HTML today we will show you how you are able to display html form values in another page after submit.

There are many methods with the help of which you are able to display html form values in same page as well as different page.

Let us understand this concept with the help of codes given below

Step By Step Guide On Display HTML Form Values In Another Page After Submit :-

Now, here at first we have to create a form in html. If you don’t know how to make a form then you must visit to our session in which we describe about how to make a simple form in html.

Now, after creation we have to make one more webpage, the codes of this page are as:

 $connect = mysqli_connect("localhost", "root", "", "as1") or die("Connection Failed");
    if (!empty($_POST['button']))
        $name = $_POST['name'];
        $email= $_POST['email'];
 $password= $_POST['password'];
        $query="insert into data(Username, Email, Password) values('$name', $email, $password)";
            echo"Ohh! sorry error found";
<!DOCTYPE html>
        a form
    <script src="js/jquery.js"></script>
<body style="text-align: center;">
        Simple form
        Fill the following details
    <form action="next_page.php" method="post">
        <label for="">
            Your Name
        <input type="text" name="name" id="name">
        <label for="">
            Your email
        <input type="email" name="email" id="email">
        <label for="">
            Your Password
        <input type="password" name="password" id="password">
        <input type="submit" value="Save" name="submit" id="register">


 Hello <?php echo $_POST["name"]; ?>!<br>
 Your mail is <?php echo $_POST["email"]; ?>.<br>
Your password is <?php echo $_POST[“password"]; ?>.<br>
  1. First, we write <! DOCTYPE html> which we used as an instruction to the web browser about what version of HTML file is written in.
  2. Secondly, the <html> tag is used to indicate the beginning of an HTML document.
  3. As above now <head> tag is used to contain information about web page. In this tag a <title> tag is used which helps us to specify a webpage title. Both <head> and <title> tags are Paired tags. So, both have </head> and </title> ending tags respectively.
  4. Here, the content to be showed on browser’s display is written here. Here, we create two php files, the first one is for save data from user whereas in other one we show data to user, which he submitted.
  5. For this php is used. When you click on button of submit you are headed to another page which is linked to first one. And you are able to see the values. If there is any error found then the webpage will show you error. We hope that you understand forms here.
  6. At last, the <body> and <html> tags are closed with </body> and </html> respectively.

Conclusion :-

In conclusion, here we can say that after this article you are able to display form values that are submit in one form and displayed in another.

I hope this tutorial on display HTML form values in another page after submit helps you.

Author Image About Riya

A recent graduate with a Bachelor of Technology (B.Tech) in Computer Science from India. She is passionate about leveraging technology to solve real-world problems. With a strong foundation and experience in programming languages such as Python, Django, HTML, CSS, and JavaScript, java, php and have honed her skills through hands-on projects and coursework.

Follow Riya On Linkedin 🡪