Im trying to make a website but this is driving me nuts.
I have a registration from (In php of course) and I want to add some validation to it. How can I do that?
I got no clue in how to.
Like if the pass and oass_conf is not the same a javascrip Alert Popup will appear saying Pass must be the same else it will submit the page.
Best way to Register?
Moderator: General Moderators
-
Phoenixheart
- Forum Contributor
- Posts: 123
- Joined: Tue Nov 16, 2004 7:46 am
- Contact:
Re: Best way to Register?
You should learn about forms and form handling with PHP.
Re: Best way to Register?
It isn't that hard really.
Try:
etc..
Try:
Code: Select all
if($password !== $pass_conf)
{
echo "<script type=\"text/javascript\"> alert('The passwords you entered to not match.'); </script>";
}
- hypedupdawg
- Forum Commoner
- Posts: 74
- Joined: Sat Apr 10, 2010 5:21 am
Re: Best way to Register?
Unfortunately, once the page loads you are stuck with your PHP code for good, and it will not run any more functions!
But don't despair! AJAX is here! ~ see article ~
i should point out that I personally have almost no experience with AJAX, but I know the theory. Basically, you are running a new PHP script in the background - feeding it parameters and taking the results - while maintaining a static HTML page. It's a great way to perform validation, as you don't have to refresh the page (annoying) change pages (time consuming) or ask them to re-enter data if it goes wrong (mind-blowingly annoying). Have fun!
But don't despair! AJAX is here! ~ see article ~
i should point out that I personally have almost no experience with AJAX, but I know the theory. Basically, you are running a new PHP script in the background - feeding it parameters and taking the results - while maintaining a static HTML page. It's a great way to perform validation, as you don't have to refresh the page (annoying) change pages (time consuming) or ask them to re-enter data if it goes wrong (mind-blowingly annoying). Have fun!