Page 1 of 1
Best way to Register?
Posted: Mon Jun 14, 2010 2:16 pm
by simon66
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.
Re: Best way to Register?
Posted: Tue Jun 15, 2010 2:15 am
by Phoenixheart
You should learn about forms and form handling with PHP.
Re: Best way to Register?
Posted: Tue Jun 15, 2010 6:08 am
by ndee
It isn't that hard really.
Try:
Code: Select all
if($password !== $pass_conf)
{
echo "<script type=\"text/javascript\"> alert('The passwords you entered to not match.'); </script>";
}
etc..
Re: Best way to Register?
Posted: Tue Jun 15, 2010 10:47 am
by hypedupdawg
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!