What I have set up right now is a login form and a signup form that is set into one page, but it toggles back and forth between the forms with some Jquery. When the login form is shown, the signup form is hidden and vice versa. When the page loads, the login form is shown, and the signup form is hidden with the option to toggle between the two with a button. Here's the issue I am running into. I have created some error handlers on the signup form (only the login form is shown when the page initially loads) with some PHP, so say when the user puts in an invalid username, I want to return the fields they entered correctly back to the form via the URL. The issue is that the login form is shown when I am taken back to the URL, not the signup form where I need to input data from the URL. I am looking for a way to access the signup form directly on page load, maybe there's a way to attach a link directly to the signup form itself? I hope I am being clear on describing my issue. Any help is appreciated.
<?php
require 'header.php';
?>
<div class="form-data text-center">
<h1 class="form-header">Header</h1>
<div id="login" class="main-login">
<form class="login-form" action="includes/login.inc.php" method="post">
<input name="mailuid" type="text" placeholder="Page Name"></input>
<br>
<input name="pwd" type="password" placeholder="Password"></input>
<br>
<button name="login-submit" type="submit">Login</button>
</form>
<p>Need to create a page?</p>
<a class="btn btn-default" href="#" id="toggle-signup">Sign up</a>
</div>
<div id="signup" class="text-center">
<form href="login_signup/signup" class="signup-form" action="includes/signup.inc.php" method="post">
<input name="pagename" type="text" placeholder="Page Name"></input>
<br>
<input name="email" type="text" placeholder="Email"></input>
<br>
<input name="pwd" type="password" placeholder="Password"></input>
<br>
<input name="pwd-repeat" type="password" placeholder="Repeat Password"></input>
<br>
<button name="signup-submit" type="submit">Login</button>
</form>
<p>Already have an account?</p>
<a class="btn btn-default" href="#" id="toggle-login">Log In</a>
</div>
</div>
<script>
$("#toggle-login").click(function(){
$("#signup").hide().attr("formnovalidate");
$("#login").show();
});
$("#toggle-signup").click(function(){
$("#login").hide().attr("formnovalidate");
$("#signup").show();
});
$("document").ready(function(){
$("#signup").hide();
});
</script>