Parse error in PHP login form

Posted by user225269 on Stack Overflow See other posts from Stack Overflow or by user225269
Published on 2010-03-07T07:20:40Z Indexed on 2010/04/20 10:43 UTC
Read the original article Hit count: 177

Filed under:
|
|

I'm trying to have a login form in php. But my current code doesnt work. Here is the form:

<form name="form1" method="post" action="loginverify.php">
<td><font size="3">Username:</td>
<td></td>
<td><input type="text" name="uname" value=""  maxlength="15"/><br/></td>
<td><font size="3">Password:</td>
<td></td>
<td><input type="text" name="pword" value=""  maxlength="15"/><br/></td>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td><input type="submit" name="Submit" value="Login" /></td>
</form>

And the verify.php

<?php
session_start();
 ?>
<?php
$host="localhost";
$username="root";
$password="nitoryolai123$%^";
$db_name="login";
$tbl="users";

$connection=mysql_connect($host, $username, $password) or die("cannot connect");
mysql_select_db($db_name, $connection) or die("cannot select db");

$user=$_POST['uname']
$pass=$_POST['pword']

$sql="SELECT Username, Password from users where Username='$user' and Password='$pass'";
$result=mysql_query[$sql];

$count=mysql_num_rows($result);
if($count==1){
    $SESSION['Username']=$user;
    echo"<a href='searchmain.php'> CONTINUE</a>";
}
else{
    echo"wrong username or password";
    echo"<a href='loginform.php'>Back</a>";
}
?>

Is there something wrong with my code. I get this parse error at line 15, which is this: $pass=$_POST['pword']

But when I try to remove it.It goes to line 16 or line 17 again. What do I do

© Stack Overflow or respective owner

Related posts about php

Related posts about msyql