The reason why it's entering 1
's in your db is because of the isset()
's for the POST arrays.
Sidenote: You may have meant to use a ternary operator http://php.net/manual/en/language.operators.comparison.php
RTM: http://php.net/manual/en/function.isset.php bool isset ( mixed $var [, mixed $... ] )
which returns a boolean.
$email=isset($_POST['email']);
$password=isset($_POST['password']);
You need to remove the isset()
.
$email=$_POST['email'];
$password=$_POST['password'];
then check if they are not empty instead.
if(!empty($_POST['email']) && !empty($_POST['password']) )
and placed inside if(isset($_POST['register'])){...}
and I have no idea why you're embedding code into textarea.
Edit: I see you removed it in an edit.
Also make sure your column types are able to store strings and not integers and are long enough to accommodate the data being stored.
Your present code is open to SQL injection. Use prepared statements, or PDO with prepared statements.
Passwords
I also noticed that you may be storing passwords in plain text. This is not recommended if you intend on going live with this.
Use one of the following:
Other links:
Important sidenote about column length:
If and when you do decide to use password_hash()
or crypt, it is important to note that if your present password column's length is anything lower than 60, it will need to be changed to that (or higher). The manual suggests a length of 255.
You will need to ALTER your column's length and start over with a new hash in order for it to take effect. Otherwise, MySQL will fail silently.
Footnotes:
You should also check for errors against your query.
and error reporting is another that will help you out here.