Ok, heres the pages ive tried, and yeah i want it spanned 3 pages for now. I have read about sessions, should I use them to pass information through pages while logged in rather than calling from a database all the time? (like maybe the persons name, or something) Well, heres my code:
index.php
Code: Select all
<html><head><title>user test system</title></head><body>
<h3>Login Here</h3>
<form method="post" action="mypage.php">
Username:<input type="text" name="un" size=10><br>
Password:<input type="password" name="pw" size=10> <br>
<input type="submit" name="submit" value="SUBMIT">
</form>
<h3>Signup Here</h3>
<form method="post" action="signup.php" name="signup">
username:<input type="text" name="un"><br>
password:<input type="text" name="pw"><br>
<input type="submit" name="submit" value="SUBMIT">
</form>
</body></html>
Logged-in page:
mypage.php
Code: Select all
<html><head><head><body><?php
$conn = mysql_connect("localhost", "root");
mysql_select_db("ed", $conn);
$sql = "SELECT * FROM user";
$result = mysql_query( $sql )
or die ( 'Unable to execute query.' );
$myrow = mysql_fetch_array($result);
if ($un==$myrowї'name'] && $pw==$myrowї'password']) {
echo "login successful, hi $un";
}
else {
echo "error!";
}
?>
</body></html>
Sign-up page:
signup.php
Code: Select all
<html><head><title>user test system</title></head><body>
<?php
$connect = mysql_connect("localhost", "root");
mysql_select_db("ed", $connect);
if ($submit=='SUBMIT') {
$sql = "INSERT INTO user (name, password) VALUES ('$un', '$pw')";
if (mysql_query($sql)) {
echo '<h2>Welcome $un!</h2>You have been added. Click back to log in.';
} else {
echo 'Error adding your info';
}
}
printf( &un );
printf( &pw );
?></body></html>
Hope that isnt too much!

If you know where I went wrong, again, IM me or email. Thank you
- Ed Johnson
.::Blue Solutions::.[/b]