-1

How do I make the login button directly to another website? I am doing this for my small business and need help. What do people need to log in? I have already completed a registration form. I would really appreciate the help.

function check(form)
{

if(form.userid.value == "person" && form.pwd.value == "WachtWoord")
{
    return true;
}
else
{
    alert("Error Password or Username")
    return false;
}
}
<html>

<body>
<form name="loginForm" method="post" action="login.php">
<table width="20%" bgcolor="ffffff" align="left">


<tr>
<td>Username:</td>
<td><input type="text" size=25 name="userid"></td>
</tr>

<tr>
<td>Password:</td>
<td><input type="Password" size=25 name="pwd"></td>
</tr>

<tr>
<td><input type="submit" onclick="location.website = 'https://www.otherwebsite.com';"></td>
</tr>

</table>
</form>


</body>
</html>
```
DCR
  • 14,737
  • 12
  • 52
  • 115
YK B.V.
  • 1
  • 2
  • Look up window.location.href: https://stackoverflow.com/questions/503093/how-do-i-redirect-to-another-webpage – paulsm4 Mar 28 '22 at 21:36
  • 1
    If this is the login form you don't want the button redirecting to another web page. You want to process the form, login.php by the look of it, the logic of that page should then redirect based on the result of the login – Jon P Mar 28 '22 at 21:40
  • 1
    "*How do I make the login button directly to another website?*" Can you be a bit clearer about what your intended functionality is? You have a form you want to use to login to a website not under your control? Can you elaborate on what the use case actually is? What is `location.website`? Can you link to an authoritative source that shows the usage of such a variable in a spec-compliant browser? "*What do people need to log in?*" This is entirely dependent on how you've structured your authentication/authorization mechanism, which looks to be based on a username/password pair. Why ask us this? – esqew Mar 28 '22 at 22:43

2 Answers2

1

where the <form> tag is, inside of the action attribute, instead of 'login.php' you need to put the 'https://www.otherwebsite.com'.

Note: the submit input is NOT where you put the link you're going to.

BGP100
  • 61
  • 5
0

I think the button should not redirect to another webpage but instead put a redirect webpage after authentication in login.php. you can check this for the tutorial link