Friday, December 14, 2018

Make a Register Form and Check the Database are Connect Or Not Using PHP

index.html   

 <html>
    <head>
        <title>My Page</title>
    </head>
<body bgcolor="skyblue">
    <form method="get" action="reg.php">
    <center>
    <table border="1">
<tr><td>Name</td>
            <td><input type="text" name="un">
</td></tr>






<tr><td>Email</td>
<td><input type="mail" name="email">
</td></tr>

<tr><td>Password</td>
<td><input type="password" name="pwd">
</td></tr>

<tr><td>Confirm Password</td>
<td><input type="password" name="cpwd">
</td></tr>

<tr>
            <td>
</td>
            <td><input type="reset" value="Reset"><input type="submit" value="Register">
</td></tr>
      </table>
  </center>
</body>
</html>


reg.php

<?php
$server="localhost";
$user="root";
$pass="";
$db="hanif";

$name =$_GET['un'];
$upass =$_GET['pwd'];
$ucpass =$_GET['cpwd'];
$email =$_GET['email'];

$con=mysqli_connect($server,$user,$pass,$db);
if(!$con)
{
echo "not connected";
}
else
{
echo "successfully connected";
}
?>










0 comments:

Post a Comment