php - Data not inserted to the database -
i trying create signup form , insert them database. coded right according knowledge, displays users exits no records in database. signup form
if (isset($_post['btn_signup'])) { $fname = $_post['fname']; $lname = $_post['lname']; $usernme = $_post['username']; $pass = $_post['password']; $email = $_post['email']; $country = $_post['country']; $dropdown = $_post['dropdown']; $query = "insert tbl_users (first_name,last_name,username,password,email,country,user_type)values('{$fname}','{$lname}','{$usernme}','{$pass}','{$email}','{$country}','{$dropdown}')"; $result = mysql_query($query, $con); if ($result) { echo "<script type='text/javascript'>alert('submitted successfully!')</script>"; } else { echo "<script type='text/javascript'>alert('user exist!')</script>"; }
}
the form is
<form action="signup.php" method="post" class="form"> <input type="text" name="fname" placeholder="first name" required="first name"><br/> <input type="text" name="lname" placeholder="last name" required="last name"><br/> <input type="text" name="username" placeholder="username" required="username"><br/> <input type="password" name="password" placeholder="password" required="password"><br/> <input type="email" name="email" placeholder="email" required="email"><br/> <input type="text" name="country" placeholder="country" required="country"><br/> <select class="wrapper-dropdown" name="dropdown"> <option value=1>player</option> <option value=2>recruiters</option> </select> <br/> <br/> <br/> <button type="submit" name="btn_signup">signup</button> <p>get in account <a href="index.php">signin</a></p> </form>
the database in order. users_id,first_name,last_name,username,password,email,country,user_type
please help!!
your query has typo...
$query = "insert tbl_users (first_name,last_name,username,password,email,country,user_type)values('{$fname}','{$lname}','{$usernme}','{$pass}','{$email}','{$country}','{$dropdown}')";
it should {username}
not {usernme}
i can't comment because of low rp. delete answer if typo not issue
Comments
Post a Comment