I fill the login form and click on submit button and page is reloaded and email id is blank how to get email id text filled?
This is the php code.
<?php
if(isset($_POST["btnSubmit"]))
{
if($_POST["txtEmail"]=="")
{
$errormsg = "Please enter Email.";
}
else if($_POST["txtPassword"]=="")
{
$errormsg = "Please enter Password.";
}
else
{
$Email = $_POST["txtEmail"];
$Password = md5($_POST["txtPassword"]);
$info = mysql_query("select * from tbluser where Email ='$Email' and Password='$Password'");
$count_info=mysql_num_rows($info);
if($count_info>0)
{
while($a = mysql_fetch_array($info))
{
$b = strcmp($a["Email"],$Email);
if($b==0 && $a["Password"]=="$Password" && $a["IsVisible"]==1)
{
$_SESSION["UserId"] = $a["user_id"];
$_SESSION["UserName"] = $a["user_name"];
header("Location:index.php");
}
else
{
$errormsg="Register Your Account First.";
}
}
}
else
{
$errormsg="Invalid email or password.";
}
}
}
?>
end of php code.
Starting of form tag.
<form name="login" method="post">
<table id="form">
<tr>
<td>
<?php
if($errormsg!="")
{
?>
<span id="errorPassword" style="padding-left:10px; color:#C00;"> <?php echo $errormsg; ?> </span>
<?php
}
?>
</td>
</tr>
<tr>
<td style="width:200px;">Email: <span style="color:#F00">*</span></td>
<td style="width:300px;"><input type="text" id="txtEmail" name="txtEmail" placeholder="Email" /></td>
<td style="width:200px;"></td>
</tr>
<tr>
<td>Password: <span style="color:#F00">*</span></td>
<td><input type="text" id="txtPassword" name="txtPassword" placeholder="Password" /></td>
<td><span id="errorEmail" style="padding-left:10px; color:#C00;"></span></td>
</tr>
<tr>
<td></td>
<td align="left" ><input type="submit" id="form_button" name="btnSubmit" value="Join Now"/></td>
</tr>
</table>
</form>
Ending of form tag.