This is my form html code
<form id="register-form" action="submit.php" method="POST" style="display: block;">
<h2>REGISTER</h2>
<div class="form-group">
<input type="text" name="fullname" id="fullname" tabindex="1" class="form-control" placeholder="Full Name">
</div>
<div class="form-group">
<input type="text" name="username" id="username" tabindex="1" class="form-control" placeholder="Username">
</div>
<div class="form-group">
<input type="email" name="email" id="email" tabindex="1" class="form-control" placeholder="Email Address">
</div>
<div class="form-group">
<input type="password" name="password" id="password" tabindex="2" class="form-control" placeholder="Password">
</div>
<div class="form-group">
<div class="row">
<div class="col-sm-6 col-sm-offset-3">
<input type="submit" name="register-submit" id="register-submit" tabindex="4" class="form-control btn btn-register" value="Sign Up Now">
</div>
</div>
</div>
</form>
This is my submit php
<?php
if ($_SERVER['REQUEST_METHOD']=='POST') {
echo "there's a post submitted";
if(isset($_POST["username"]) && isset($_POST["email"]) && isset($_POST["password"]) && isset($_POST["password"])){
require_once './DB_Functions.php';
$db = new DB_Functions();
// receiving the post params
$name = $_POST['fullname'];
$email = $_POST['email'];
$password = $_POST['password'];
$username = $_POST['username'];
// create a new user
$user = $db->storeUser($name, $email, $password, $username);
if ($user) {
// user stored successfully
$_SESSION["uid"] = $user["unique_id"];
$_SESSION["name"] = $user["name"];
$_SESSION["email"] = $user["email"];
$_SESSION["nickname"] = $user["nickname"];
haeader("Location","details.php");
} else {
// user failed to store
echo "Problem.";
}
}
else {
// in here i wantted to see which parameters are missing.
echo ($_POST["username"]);
echo ($_POST["fullname"]);
echo ($_POST["email"]);
echo ($_POST["password"]);
}
}
?>
And this is the response from submit.php
there's a post submitted Notice: Undefined index: username in C:\xxx\submit.php on line 32
Notice: Undefined index: fullname in C:\xxx\submit.php on line 33
Notice: Undefined index: email in C:\xxx\submit.php on line 34
Notice: Undefined index: password in C:\xxx\submit.php on line 35
Why I can't receive values from submit.php?