0

hello everyone ,
Can anybody help, as i m a beginner in PHP, i try to just check user is valid or not ...
I hav 2 fields...Username and Password..as user enter username and password, click on submit button then in the same page the query execute and user is valid or not it give a message.
I just try this ..

<html>
<head>
<style type="text/css">
<!--
.style1 {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 18px;
    color: #996633;
    font-style: italic;
    font-weight: bold;
}
.style3 {font-size: 18px}
.style4 {font-size: 16px; }
-->
</style>
<?PHP 
if(isset($_POST[submit1]))
{

$my_con=mysql_connect("localhost","root","xyx");
if($my_con)
{
$my_db= mysql_select_db("db_ash",$my_con);
if($my_db)
{
$sql= "select loginName from member where loginName='$_POST[user]'";
$my_user= mysql_query($sql);
if($my_user)
echo "Login User";
else
print "Username or Password is incorrect";
}
}
}
?>
</head>

<body>

<div align="center">
<form id="form1" name="form1" method="post" action="default.php">
  <table width="283" border="0">
    <caption>
      <div align="left"><span class="style1">Login Page      </span>      </div>
    </caption>
    <tr>
      <td width="88" height="40" bgcolor="#AAB0B0"><span class="style3">Username</span></td>
      <td width="185" bgcolor="#AAB0B0">
          <div align="center">
            <input type="text" name="user" />           
            </div></td>
    </tr>
    <tr>
      <td width="88" height="40" bgcolor="#AAB0B0"><span class="style3">Password</span></td>
      <td bgcolor="#AAB0B0">
        <div align="center">
          <input type="password" name="pass" />
        </div></td>
    </tr>
    <tr>
      <td height="40" colspan="2" bgcolor="#AAB0B0"><p align="center"><a href="#" class="style4"> Forgot Password </a>&nbsp;&nbsp;&nbsp;
      <a href="#"> Change Password </a> </p>
        <p align="center">
          <label>
          <input name="Submit1" type="submit" class="style1" value="LogIn" />
          </label>
        </p></td>
    </tr>
  </table>
  </form>
</div>
</body>
</html>

Please reply me....

Edited by mike_2000_17: Fixed formatting

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by pritaeas
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.