I am taking three inputs from user: UserName, FirstName, Email.
I want to check that if username is present in database then it should check its corresponding Firstname and email. And if all the three are correct then print message.
html code:
<html>
<body>
Username: <input type="text" name="username"/>
FirstName: <input type="text" name="name"/>
Email: <input type="text" name="email"/>
</body>
</html>
PHP code:
if(isset($_POST['submit']))
{
$usrnm=$_POST['username'];
$name=$_POST['name'];
$email=$_POST['email'];
$user_name = "root";
$password = "";
$database = "show_your_talent";
$server = "127.0.0.1";
$db_handle = mysql_connect($server, $user_name, $password);
$db_found = mysql_select_db($database, $db_handle);
if ($db_found)
{
$res="SELECT UserName,Fname,Email FROM reg WHERE UserName='$usrnm'";
$result = mysql_query($res);
$count=mysql_num_rows($result);
if($count==1)
{
echo "<script type='text/javascript'> alert('Password has been sent to your email id..')</script>";
}
else
{
echo "<script type='text/javascript'> alert('Wrong')</script>";
}
}
mysql_close($db_handle);
}