How to Stay on Same Page after Submit in PHP
Program 1
<html>
<head><title>User Login Application</title>
<body>
<center>
<form method=post action=userlogin.php>
<table border=1>
<tr>
<th>User Name: </th>
<td><input type=text name=txtuser></td>
</tr>
<tr>
<th>Password: </th>
<td><input type=password name=txtpass></td>
</tr>
<tr>
<td></td>
<td><input type=submit value=Submit name=submitbtn></td>
</tr>
<table>
</form>
<?php
if(isset($_POST['submitbtn']))
{
$user=$_POST['txtuser'];
$pass=$_POST['txtpass'];
// echo $user."<br>";
// echo $pass."<br>";
if((strcasecmp($user,"dataflair")==0) && (strcmp($pass,"indore")==0))
echo "<font color=green size=5>Valid user</font>";
else
echo "<font color=red size=5>Invalid User</font>";
}
// Stduent
?>
</center>
</body>
</html>
Tags: how to stay on the same page after submit buttonhow to stay on the same page after submit button in phpPHPphp practicalphp programstay on the same page after submit button in php