Create form and load data in database mysql



MySQL , PHP, HTML BASICS

Hi Everyone

Today we are going to see how to make this kind of website

For this you can add alotof things but it is for the basics how to make form and add data to the database.

For this you can use html ,php language if you want to learn it you can go to YouTube and watch the video.

You can watch my youtube channel for the technology.
I will share you the code for this website so that you can learn it.

Html code

<html>
    <head>
        <title>Registration Form</title>
    </head>
    <body bgcolor="skyblue">
        
            <form  method="POST">
                <table>
                <tr>
                    <td>
                        Email
                    </td>
                    <td>&nbsp;</td>
                    <td><input type="box" name="email" required></td>
                    
                </tr>
                <tr>
                <td>
                    Password
                </td>
                <td>&nbsp;</td>
                <td><input type="password" name="password" required></td>
                </tr>
                <tr><td><input type="submit" ></td></tr>
                
           
        </table>
        </form>
    </body>
</html>

And the php code
<?php

$email=$_POST['email'];
$password=$_POST['password'];
$mysqli = new mysqli(host name, username, password, database name);

if ($mysqli === false) {
die("ERROR: Could not connect. ".$mysqli->connect_error);
}

$sql = "INSERT INTO mytable (email,password)
VALUES('$email','$password') ";
if ($mysqli->query($sql) === true)
{
echo "Records inserted successfully.";
}
else
{
echo "ERROR: Could not able to execute $sql. "
.$mysqli->error;
}

// Close connection
$mysqli->close();
?>


Here hostname username and database name will be shown when you go to database and create a new data base.

For the update database and delete database  stay tuned I will do it after somedays.

Comments

Post a Comment