php - Form not POSTing values -
form:
<form id="register" method="post" action="pro/register.php"> <input type="text" maxlength="30" placeholder="username" id="user" /><br /> <input type="email" maxlength="64" placeholder="email" id="email" /><br /> <input type="password" placeholder="password" id="pass1" /><br /> <input type="password" placeholder="confirm password" id="pass2" /><br /> <input type="submit" value="register" id="submit_register" /> </form>
pro/register.php
page:
$user = $_post['user']; $email = $_post['email']; $pass1 = $_post['pass1']; $pass2 = $_post['pass2']; //debug echo "<strong>details:</strong><br>"; echo $user.", ".$email.", ".$pass1.", ".$pass2."<br>"; if($pass1!==$pass2){ header('location:../login.php?alert=pass'); exit; } $hash = hash('sha256', $pass); include "../inc/functions.php"; $salt = createsalt(); $hash = hash('sha256', $salt . $hash); include "../inc/connect.php"; $stmt = $dbh->prepare("insert `users` (`username`,`email`,`password`,`salt`,`pic`) values (:username,:email,:password,:salt,:pic)"); $stmt->bindparam(':username',$user); $stmt->bindparam(':email',$email); $stmt->bindparam(':password',$hash); $stmt->bindparam(':salt',$salt); $stmt->bindparam(':pic',$pic); $stmt->execute(); $dbh=null; header('location:../login.php?alert=newreg');
output when form posted:
details: , , ,
<input type="text" maxlength="30" placeholder="username" id="user" name="user"/><br />
try adding name field.
Comments
Post a Comment