Javascript Display issue

Hey,

Take a look at this page:

http://www.freemanholland.com/babies/

I have 2 Divs ‘sign-up’ and ‘sign-up-two’ and i use Javascript to display each one depending on the clicking of a link.

Now When you click on “Already a member? Click here to login”, You will see a login box. When you submit the form the page reloads. I want the box to remain showing the login form…

I tried doing this:


<?
	if(isset($_POST['register'])){ ?>
		<script type="text/javascript" language="javascript">
		document.getElementById('sign-up').style.display='none';
		document.getElementById('sign-up-two').style.display='block';
		</script>
	<?
		if(isset($_POST['email']) && $_POST['email'] != '' && isset($_POST['password']) && $_POST['password'] != '')
		{
		    if(User::AuthenticateSiteUser()){
		    }else{
		        $error = "<div class=\\"error\\">Email or Password incorrect.</div>";
		    }
		}
	}
	?>

But it didn’t work…

Any ideas how i can do this??

Thanks again

You should use AJAX to do that and to make it easier you can use javascript framework like jQuery or prototypejs

Thanks :slight_smile: