I made a registration form on a light box using the javascript function. Now I want to save the value in a session variable to check if the user has been connected to the Internet, and also not to show his lightbox for login again and again in his navigation on the page. My javascript function:
<script language="javascript" type="text/javascript">
function createlightbox()
{
document.getElementById('light').style.display='block';
document.getElementById('fade').style.display='block'
}
function closelightbox()
{
document.getElementById('light').style.display='none';
document.getElementById('fade').style.display='none'
}
function checksession()
{ if (admin=="admin")
{closelightbox();}
else
{createlightbox();}
}
function check(form)/*function to check userid & password*/
{
if(form.name.value == "admin" && form.password.value == "admin")
{
closelightbox();
var admin = <?php $_SESSION['Admin']= 1; ?>
}
else
{
document.getElementById("error").style.display='block';/*displays error message*/
}
}
</script>
And I call the validation function in my onsubmit event forms as
<form id="Admin" onreset="checksession()">
The problem is that on every reset or when submitting the form, even when the page is changed, the login form is displayed. Why does he not check the function of the control session. Please tell me any mistake I make
source
share