"without leaving current page" - very bad idea.
Firstly, whet is your form action? It should normally lead to a validation script, which user does not see, and that in turn can lead to successful login page, or, as you seem to want, to rebuild the first log in" page, with an error message.
This is all very standard. Just google for something like PHP login form validation tutorial (or example).
Don't worry, PHP is eacy to learn (but get a good IDE, like NetBeans).
Good luck!
[Update] I just googlged for php login example
and there are some good hits. For instance, the first one http://www.9lessons.info/2009/09/php-login-page-example.html but why look at a few from the first page of hits?
IMPORTANT: a lot of people here are telling you that MUST use client-side code. That is 100% NOT the case.
Yes, client-siders, I can, and do, code client side (I started with plain JS, moved on to JQuery & am now coding AndularJs). I know why client-side, Ajax or otherwise, is A Good Thing, but it sounds like OP is just beginning, so why not let him master server-side first? Then, when he has mastered that , he can look at client-side (I am just afraid that someone here will try to talk him into using NodeJs on the server side. Again, not totally wrong, but for a beginner, it's best to start with PHP)
This can be done entirely on the server side. Parts of login MUST be done on the server side (where are you going to validate the password?).
OP, some form input can be validated at client side (is that a valid date, zip code, etc Is a mandatory field blank?)
You can (I can even say "should") do that client side to avoid a round trip to the server.
But, you can also just chuck all user input at the server and let it sort it out. I strongly recommend this - for a leaner.
I advise you, as a leaner, to:
- become reasonably proficient in server side before getting into client side (but do lean both in the medium term)
- get a good IDE, such as NetBeans, and learn how to use the debugger
- look at other people's code. Google for
tutorial
or example
for whatever you seek to do. It wouldn't hurt to buy a book to learn from.
Client-siders - a plea - let's not start a flame war. I know why you are advocating what you are advocating, but it is not 100% necessary - in this case - it can all be done server side and I am just trying to help the OP learn, rather than decide that it is all too complicated & give up & walk away.