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....

Check your casing, in the form you use Submit1, in php submit1. They should match exactly.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.