0

I have an HTML login form in my website in which the user enters some credentials and they get sent to another website.

Here is the form:

<form action="http://dashboard.babylonholiday.com/reseller/auth/" method="post" id="login_form">

When the credentials are correct, the user gets sent to the other website and logins in successfully. However, when they enter wrong information, they still get sent to the other website and there it displays wrong username and password.

Now, my question is, can I make an error message show in my website when the user enters wrong information instead of redirecting to other website?

BilendM
  • 43
  • 8
  • 2
    you can use ajax to send request and authenticate the user, if they've entered the correct credentials redirect to main page else show error. see https://stackoverflow.com/questions/14449118/php-ajax-login – Junius L Mar 16 '19 at 07:02
  • @julekgwa I am completely oblivious to what Ajax is. Do I write the scripts and PHP in the same place where my form is or do I write it somewhere else? – BilendM Mar 16 '19 at 07:23
  • 1
    see this example https://stackoverflow.com/questions/16616250/form-submit-with-ajax-passing-form-data-to-php-without-page-refresh?answertab=oldest#tab-top – Junius L Mar 16 '19 at 07:27

2 Answers2

0

you can use alert message in your code to make user know about prompt message

using Javascript inside ur code

or displaying echo message using php

hope it would help you somehow

https://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_alert
sabeen kanwal
  • 607
  • 1
  • 5
  • 16
0

Use alert box inside your code. An alert box is often used if you want to make sure information comes through to the user.

<button onclick="myFunction()">Try it</button>

<script>
function myFunction() {
  alert("I am an alert box!");
}
</script>
Kowsigan Atsayam
  • 446
  • 1
  • 9
  • 20