Registration From

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
tito85
Forum Contributor
Posts: 104
Joined: Sat Mar 13, 2010 11:26 am

Registration From

Post by tito85 »

Hi,

I have a registration form that users use to register onto the website.

A problem I have is that during the registrtion the user must select a password and then reconfirm that password.

If for example the passwords does not match and the user click the register button, an error will be displayed which is good. BUT all the information that the user has entered like name, surname, address etc are lost.

Is it possible to keep this data from beeing lost so that the user only needs to correct the password?

Thanks
User avatar
Goofan
Forum Contributor
Posts: 305
Joined: Wed Nov 04, 2009 2:11 pm
Location: Sweden

Re: Registration From

Post by Goofan »

I think you are refering to saving them into sessions (only for a short time)
so that when the user inputs something into the password box the password gets saved in the session for a while...
steel_rose
Forum Newbie
Posts: 15
Joined: Thu May 13, 2010 9:17 am

Re: Registration From

Post by steel_rose »

Hi,

I associate the "value" attribute in the form input to create a default.
First I send the data to a script that checks the fields and, if they are correct, I put the results in a "clean data" array. If not, I create an "error messages" array and populate it with error messages.
At the end of the script, if the "error messages" array is empty the information is put (usually) in a database, otherwise the form is displayed again with the error messages on top.
The default values are associated with "clean data" array and, if something had been passed on, it will be displayed (otherwise, it will stay empty).

Code: Select all

Name: <input type ="text" name="name" maxlength="25" value="<?php echo $arrCleanData['name']?>"><br />

Let me know if this works for you.

SR
Post Reply