Reputation: 123
I have a login/register element where users login and register in the same form. The form exists of email and password. The downside is if a user mistypes his/her email....since then a new user will be added unintentionally to mysql.
I would like an alert of some kind where users can click 'yes' or 'no' to create a new account.
Any ideas how to do this best?
Upvotes: 1
Views: 957
Reputation: 2014
I don't think having a login / registration form being the same form and same submit button is a good idea. If you really want, I think Amazon has something similar where you type in your username and then use a radio button to select "I'm a new customer" or "I have a password." They have to specify on login which they want, and then they click "Login" to either login or signup (depending on their selection.)
Doing it that way makes it more intentional for a user to either login or signup.
Upvotes: 1
Reputation: 1
<html>
<head>
<script type="text/javascript">
function show_confirm()
{
var c=confirm("Do you want to create an account?");
if (c==true)
{
document.getElementById("frm1").setAttribute("action","create.php");
}
document.getElementById("frm1").submit();
}
</script>
</head>
<body>
<form id="frm1" action="login.php">
<label for="email">Email:</label>
<input type="text" name="email" />
<label for="password">Password:</label>
<input type="password" name="password" />
<input type="button" onclick="show_confirm()" value="Submit" />
</form>
</body>
</html>
Upvotes: 0