billy_111 Posted June 10, 2010 Share Posted June 10, 2010 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 Billy Link to comment https://forums.phpfreaks.com/topic/204388-javascript-display-issue/ Share on other sites More sharing options...
JasonLewis Posted June 10, 2010 Share Posted June 10, 2010 Another way you can do it is this. Instead of specifying in the CSS file whether it is hidden or a block level element, do it in the style attribute. For example. if(isset($_POST['formData'])){ $signUpOneStyle = "none"; $signUpTwoStyle = "block"; }else{ $signUpOneStyle = "block"; $signUpTwoStyle = "none"; } Then, in your <div> tag, set the style attribute like so: <div style="display: <?php echo $signUpOneStyle; ?>" id="sign-up"></div> Hopefully that makes sense. Best of luck. Link to comment https://forums.phpfreaks.com/topic/204388-javascript-display-issue/#findComment-1070346 Share on other sites More sharing options...
billy_111 Posted June 10, 2010 Author Share Posted June 10, 2010 Thank you so much! That worked perfectly.. Thanks again Link to comment https://forums.phpfreaks.com/topic/204388-javascript-display-issue/#findComment-1070380 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.