Hey!
i'm working on a simple sign up form. that's consisted to 4 pages, 2 html and 2 php
signup.htm make.php login.htm getin.php
and using a server running PHP, mySQL, and phpMyAdmin. i have created a mySQL table which will store the user's name and password when they create it. and, logged on to phpMyAdmin, and select the database. My database is called "easyflas_testdb". Inside the database, i made a table, called it "users" and have 4 columns for it.
id - INT (auto increment, primary)
username - text
password - text
email - text
so i made the user and password, i setup the host and the database!. all are fine till now
and then i went ahead and start making my signup form which starts with the page signup.htm and has this code:
<form action="make.php" method="post">
Username Desired: <input type="text" name="username" size="10">
Password Desired: <input type="password" name="password" size="10">
E-mail: <input type="text" name="email" size="10">
<input type="submit" value="submit" name="submit">
</form>
then i started with my make.php page which will post the info to the SQL data base, make.php has this code:
<?
$conn = mysql_connect("localhost","MYUSER","PASSWORD");
$db = mysql_select_db("easyflas_testdb");
$username = $_POST["username"];
$password = $_POST["password"];
$email = $_POST["email"];
$result= MYSQL_QUERY("INSERT INTO users (id, username, password, email)".
"VALUES ('NULL', '$username', '$password', '$email')");
echo "Your name and password have been submitted into our database ";
?>
ok done from this test it and no errors it says "Your name and password have been submitted into our database"
but these info are not submited into the TABLE! i checked it times and times, and still telling me that it was submited , but it's not actually.
now i tried anyway to signin using info i used in the signup page using this page login.htm which has this code:
<form action="getin.php" method="post">
Username: <input type="text" name="username" size="10">
Password: <input type="password" name="password" size="10">
<input type="submit" value="submit" name="submit">
</form>
and followed by the page getin.php which is :
<?
$conn = mysql_connect("localhost","MYUSER","PASSWORD");
$db = mysql_select_db("easyflas_testdb");
$username = $_POST["username"];
$password = $_POST["password"];
$result = MYSQL_QUERY("SELECT * from users WHERE username='$username'and password='$password'")
or die ("Name and password not found or not matched");
$worked = mysql_fetch_array($result);
$username = $worked[username];
$password = $worked[password];
$email = $worked[email];
if($worked)
echo "Welcome $user! Your e-mail address is $email";
?>
but it's telling"Name and password not found or not matched" me though i also tried to enter these info manually from inside the phpAdmin page! not using the form , so in both cases it's not working .
so please if anybody knows what may be happening i will be thankfull for him
thanks in advance