hi i tried to make validation using php but i want to do it in another page like (make form action="page.php") and do validation and send data in page.php but form in page login.html i don't like to do all php code in the same page by using PHP_SELF
thanks and sorry for my bad english
html code (login.html)
<form class="well" role="form" action="page.php" method="post">
<input type="text" name="user" class="form-control" placeholder="User Name"/><br><br>
<span><?php echo $userErr ?></span>
<input type="password" name="pass" class="form-control"placeholder="Password" /><br><br>
<span><?php echo $passErr ?></span>
<input type="submit" value="Login" class="btn btn-success" style="margin-left: 45px;"/>
<a data-toggle="modal" href="#myModal" class="btn btn-info">forget your password?</a>
</form>
php code (page.php)
$userErr = $passErr = "";
$user = $pass = "";
if($_SERVER['REQUEST_METHOD']=="POST"){
if(empty($_POST['user'])){
$userErr = "Please Insert Your Name";
}elseif(strlen($_POST['user'])>20){
$userErr = "Your Name Is greater than 20 char";
$user = $_POST['user'];
}
else{
$user = $_POST['user'];
}
if(empty($_POST['pass'])){
$passErr ="Pleaes your password";
}
else{
$pass = $_POST['pass'];
}
}