I have got this code (HTML form) and one more file (PHP logic) but clicking on the Submit button nothing happens -- no errors either. Pls help what's wrong.
<html>
<head>
<title> Registeration Form</title>
<link rel="stylesheet" type="text/css" href="design.css">
</head>
<body>
<div class = "title"><h1>Register form </h1></div>
<div class = "container">
<div class="left"></div>
<div class="right">
<div class="formBox">
<form action="" method="POST">
<input type="text" id="fname" name="firstname" placeholder="First Name"/>
<input type="text" id="lname" name="lastname" placeholder="Last Name"/>
<input type="text" id="email" name="email" placeholder="Email"/>
<input type="password" name="password1" placeholder="Password" />
<input type="password" name="password2" placeholder="Confirm Password" />
<input type="submit" name="submit">
</form>
</div>
</div>
</div>
<?php
if (isset($_POST["submit"]))
{
require'dbconnect.php';
$firstname = $_POST["firstname"];
$lastname = $_POST["lastname"];
$email = $_POST["email"];
$password = $_POST["password1"];
$confirmPass = $_POST["password2"];
$encryptedPassword = md5($password);
mysqli_query($link,"insert into users(FirstName, LastName, Email, Password)
values ($firstname, $lastname, $email,'$encryptedPassword')");
echo "<br>";
}
?>
</body>
</html>
Here is PHP code -- that connects to SQL ... I'm using WAMP64 bit on Windows 10 but i have a similar setup that has no issue but this code is not working ... i tried all that i could.
<?php
//Hostname on which MYSQL is stored
$hostname = "localhost";
//MySQL server Username ... which is root
$username = "root";
// MySQL password which by default is empty
$password = "";
//Database name to which we connect...
$dbname = "signup";
// Connection to database;
$link = mysqli_connect ($hostname,$username,$password);
if (!$link){
die ("Could not connect: ".mysql_error());
}
mysqli_select_db($link, $dbname);
?>