I created the sign up form as a hidden div above the whole website with some js. Now, I want to create the php part, in a different file. I have 3 files. The html, where is the div, form. The js file, where is the switch between the hidden and show state, and it's called by a button. And the 3. one is the php, where are the if-s(empty fields, wrong datas, etc.), the mysql stuff. If the user make a mistake, I want to send back to the main html file, where is the form, with the given datas in the url, so I can say what was the problem. But if I do this, the registration form will be closed, because it's again a display:none. How can I set the div's display again from the php, after I send back the user? Sorry if it's complicated...
I tried to call the js function in the php, after I send back with the header function, but it didn't work.
HTML div:
<div id="reg-Page">
<!-- Form, and others -->
</div>
Call div:
<button type="button" name="button" onclick="return regForm()">Signup</button>
js function:
function regForm() {
var logWindow = document.getElementById('reg-Page');
if (logWindow.style.display != 'block') {
logWindow.style.display = 'block';
} else {
logWindow.style.display = 'none';
}
}
PHP file:
if (empty($username) || empty($password) || empty($password2) || empty($email)) {
?>
<script src="js/scripts.js" type="text/javascript">
return regForm()
</script>
<?php
header("Location: ../index.php?error=emptyfields&uid=".$username."&mail=".$email);
exit();
}
I tried to set the div display to block again, after the send back.