PHP program to develop E-mail registration form

Write a PHP program to develop E-mail registration form and store all the submitted data in database table.


In this tutorial, you will learn how to develop E-mail registration form and store all the submitted data in database table in php.

Below is the php script to develop E-mail registration form and store all the submitted data in database table in php.

<html>
<head>
    <title>PHP program to develop E-mail registration form & Save in Database in PHP</title>
</head>
<body>

    <h2>Write a PHP program to develop E-mail registration form and store all the submitted data in database table.</h2>

    <form action="" method="POST">

        <h3>Id</h3>
        <input type="text" name="ID">

        <h3>Username</h3>
        <input type="text" name="username">

        <h3>Email</h3>
        <input type="text" name="Email">

        <h3>Password</h3>
        <input type="password" name="Password">

        <h3>Active</h3>
        <input type="text" name="Active"> <br>

        <input type="submit" name="submit">

    </form>

    <?php
        $connection = mysqli_connect("localhost","root","");
        $db = mysqli_select_db($connection,'email_reg');

        if(isset($_POST['submit']))
        {
            $id = $_POST['ID'];
            $uname = $_POST['username'];
            $email = $_POST['Email'];
            $pswd = $_POST['Password'];
            $act = $_POST['Active'];

            $query = mysqli_query($connection,"INSERT INTO registration VALUES ('$id','$uname','$email','$pswd','$act')");
           
            if($query)
            {
                echo 'user created successfully';
            }
            else
            {
                echo 'user registeration failed';
            }
        }
    ?>
   
</body>
</html>



Thanks for reading.

© Copyright - 2018 - 2022 | All rights reserved at Funda of Web IT