Back Button During Registration

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
User avatar
jwalsh
Forum Contributor
Posts: 202
Joined: Sat Jan 03, 2004 4:55 pm
Location: Cleveland, OH

Back Button During Registration

Post by jwalsh »

Hi,

I have a registration signup form that contains multiple steps. The account is actually created (although with only a name, email, username, and password) initially, and the extra data is added in subsequent steps. I have a routine to check if the user has signed up previously by checking email, and throwing a different page at you if thats the case.

The signup process works great, as long as you don't hit the back button. If you do, you get the "Already Member" page. My thoughts on how to do this...

1) use session vars to store the data as it's entered, then compile all the data using 1 insert at the end.
2) take the data into a temporary signup table, and check if the data is in this table on page refresh, if it is, just refill the data, otherwise throw the "Already member" page. Last step moves data to it's final position.

I'm leaning towards option number 1, but thought I would ask for your thoughts on the best way to accomplish this.

Josh
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

I'd lean heavily toward option 3: present and require only the most basic amount of information. Allow the user to fill in the other information when they feel like it.
User avatar
jwalsh
Forum Contributor
Posts: 202
Joined: Sat Jan 03, 2004 4:55 pm
Location: Cleveland, OH

Post by jwalsh »

Feyd,

Actually, that is the case. This is for corporate purposes, and some information is required during signup. Just in case, as I mentioned, the first step will actually create the account with email, username, password, etc. So if they do hit the back button, they can still login and will be prompted to enter the required information before continuing.

However, the situation as it currently stands isn't very friendly. A user should get to go back to the last form if necessary.

I agree with you completely in a simple signup for a public interest website, but since certain credentials are required before any action can be taken, it's not very viable, and just plain ugly to do in a one page form with AJAX for the dynamic lookups.

So, since I do need this information... are any of my options, the best options?

Josh
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

if the site only needs these pieces of information for certain actions, I'd require the user to fill that information in when they wish to take those actions. This way, the user doesn't have to do extra work when it isn't needed. Now, if the information is needed for all actions, or you insist on making someone fill in the information first, then I'd store the information in a session (potentially allowing the user to save their registration details for say a month.)
User avatar
Maugrim_The_Reaper
DevNet Master
Posts: 2704
Joined: Tue Nov 02, 2004 5:43 am
Location: Ireland

Post by Maugrim_The_Reaper »

Well, if you need to store between requests it certainly looks like $_SESSION... A temporary table might work too, but then you'd need the added hassle of deleting partially completed rows, and SQL queries. Why go so far when all you really need is a simple array?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

building a decent implementation of a database session handler would handle all of it rather nicely.. ;)
User avatar
jwalsh
Forum Contributor
Posts: 202
Joined: Sat Jan 03, 2004 4:55 pm
Location: Cleveland, OH

Post by jwalsh »

Looks like I've found my solution... I'll go with the sessions. Thanks guys.
User avatar
jwalsh
Forum Contributor
Posts: 202
Joined: Sat Jan 03, 2004 4:55 pm
Location: Cleveland, OH

Post by jwalsh »

Took me a little while to try and implement it, but it worked great!

Thanks.
User avatar
Maugrim_The_Reaper
DevNet Master
Posts: 2704
Joined: Tue Nov 02, 2004 5:43 am
Location: Ireland

Post by Maugrim_The_Reaper »

cool :)
deltawing
Forum Commoner
Posts: 46
Joined: Tue Jun 14, 2005 2:55 pm

Post by deltawing »

I'm just throwing an idea around, haven't really thought this through. And you've got a method which works, so there'd be no point in changing it. I just thought I'd bring the idea up anyway.

Rather than storing all the data in a session var, why not, when the user first signs up, reference the record in the table as a session var. That way, if someone using the same session tries to sign up again with the same login name et cetera, a different page can be presented. It would probably be best, if you decide to go with this idea, to make it completely seamless so that their details are updated without any error messages or anything. What do you think?
User avatar
jwalsh
Forum Contributor
Posts: 202
Joined: Sat Jan 03, 2004 4:55 pm
Location: Cleveland, OH

Post by jwalsh »

That would probably work as well, but this is a pretty high volume server, and I dont see a need to throw another field into the DB to query. Probably wouldn't make a whole lot of difference though.
Post Reply