mysql - php database data saving -
i making sign form using php when click on register button, saves 1,1 in email , password fields instead of given email , password.
<?php include("connection.php") ?> <?php $email=isset($_post['email']); $password=isset($_post['password']); if(isset($_post['register'])) { $q= "insert admin (email, password) values ('$email', '$password')"; $qr=mysqli_query($con, $q); if($qr) { echo "data added sucessfully"; } else { die(); } } ?> <!doctype html> <html> <head> <title>log in</title> </head> <body> <form method="post" action=""> <input type="email" name="email"> <br> <input type="password" name="password"> <br> <button type="submit" name="register" value="register">register</button> </form> </body> </html>
http://php.net/manual/en/function.isset.php
isset function return boolean, try :
if(isset($_post['email'])){ $email=$_post['email']; } if(isset($_post['password'])){ $password=$_post['password']; }
Comments
Post a Comment