Best way to Register?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
simon66
Forum Newbie
Posts: 1
Joined: Mon Jun 14, 2010 2:12 pm

Best way to Register?

Post 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.
Phoenixheart
Forum Contributor
Posts: 123
Joined: Tue Nov 16, 2004 7:46 am
Contact:

Re: Best way to Register?

Post by Phoenixheart »

You should learn about forms and form handling with PHP.
ndee
Forum Newbie
Posts: 2
Joined: Tue Jun 15, 2010 5:54 am

Re: Best way to Register?

Post 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..
User avatar
hypedupdawg
Forum Commoner
Posts: 74
Joined: Sat Apr 10, 2010 5:21 am

Re: Best way to Register?

Post by hypedupdawg »

Unfortunately, once the page loads you are stuck with your PHP code for good, and it will not run any more functions! :banghead:

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!
Post Reply