javascript - php show login status message does not update -
I am trying to display a status message when someone tries to log me in. The problem I have is:
- After checking the login, and it does not match, this output does not
$ loginStatusMessage == "does not match" Is but not within HTML (which I like because it is wrapped in CSS styling tag).
- Instead, HTML
$ loginStatusMessage echos "welcome" even after the variable is updated.
I'm guessing because PHP is called to run only after the form, re-sms reload message with this $ login? How do I create it so that HTML changes
$ loginStatusMessage to
when I submit the form
I have a global variable
$ Login status message
$ loginStatusMessage = "welcome"; If (isset ($ _ POST ['submit'])) {login ($ user name, $ password); } Function login ($ username, $ password) {if (check! Login ($ username, $ password)) {$ loginStatusMessage = "does not match ..."; Echo $ loginstats messages; } And {session_start ();
This output outputs:
"does not match" , but not inside the body in HTML
But in my body, I have:
& lt; P class = 'loginMsg' & gt; & Lt ;? Php; Echo $ loginStatusMessage; ? & Gt; & Lt; / P & gt;
This gives echo output:
"welcome"
so when I submit the form I call it File:
& lt; Form id = 'register' action = "& lt ;? php echo $ _SERVER ['PHP_SELF'] ;? & gt;" Method = 'post' accept-charset = 'UTF-8' & gt;
declare variable
$ loginStatusMessage;
And then if your "verification" verification in your code then
$ loginStatusMessage = "welcome";
if not
$ login statusMessage = "do not match";
In this section, you will need to print the variable to do this:
Hope it helps
- Instead, HTML
Comments
Post a Comment