i hope you got my point from the title box..
here's the problem:
im trying to create a simple login/logout using function.. i have a login.php and function.php
im trying to do this because i learned that if you use a function into your script.. it wont be messy.
this is the code for the login.php
<form method="POST" action="function.php">
<table>
<tr><td>Username:</td><td><input type="text" name="user" value=""></td></tr>
<tr><td>Password:</td><td><input type="password" name="pass" value=""></td></tr>
<tr><td><input type="submit" name="login" value="Login"></td></tr>
</table>
</form>
this is the code for the function.php
//for login
function login(){
$user=$_POST['user'];
$pass=$_POST['pass'];
$sql="select * from account where username='".$user."' AND password='".$pass."'";
$sql2=mysql_query($sql);
}
//pass the $sql2 to the check function
function check(){
login($sql2);
while($row=mysql_fetch_array($sql2)){
echo $a=$row['username'];
echo $b=$row['id'];
echo $c=$row['password'];
}
}
check();