Incorrect username / password message and redirect

。_饼干妹妹 提交于 2019-12-04 19:35:16

You need to change extension of clientLogin.html from .html to .php

Change header('Location: clientLogin.html'); to header('Location: clientLogin.php');

Add this part of code at the top of your clientLogin.php page:

<?php 
session_start();
if(empty($_SESSION['username'])) {
 echo 'incorrect username/ password please try again.' ;
}
?> 

   

You can set a SESSION flag and when calling ClientLogin.

    $_SESSION['loginerror'] = 1;

in ClientLogin.php

    if ($_SESSION['loginerror'] > 0) {
      /* Display Appropriate Error message */
    }

you should use exit(); after redirecting to other file like..

header('Location: profile.php');
exit();

you please use mysqli instead of mysql .its not going to be supported by new version of php.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!