Jump to content

Switch or Multi-Page?


steelmanronald06

Recommended Posts

I have recently recoded my entire website using Switch on most of it.  I have scripts that at one point required up to six different pages (User Registration), that are now all in /register/index.php as a switch.  My question is what is best used here?  Multi-Page or a switch?  I know some hosts will sometimes allow you to only have a max amount of pages created, on top of the WebSpace they give you.  So in that instance it would be good to use less pages, but say your like me and have your own server.  Does it matter? Personal preferences?
Link to comment
Share on other sites

a multi-page registration, spread throughout several script files is going to require the use of sessions, cookies, or hidden inputs. or i guess you could also store info in a db or flatfile if you [i]really[/i] wanted to.. but on the other hand, having it all on one page will reduce methods used to just post vars. 

either way you are going to have conditioning for form validation.  I suppose it probably boils down to preference, but I personally think it would be easier to follow if all of the form validation conditioning were in one place, rather than spread out over several pages. 

and on that note, if you [i]were[/i] to have a registration spread out over several pages, at what point does your script start spitting out errors? After each page, no letting the user continue to the next page until the first one is acceptable? Or waiting until the end? That's going to make a big difference in coding, as well.

Also I have to kind of wonder why your registration process is taking more than one page to begin with? I personally think that ideally, a registeration script should be no more than one page to begin with.  Get the vitals, and that's it.  Anything else should be on some other "account preferences, settings, optional info, etc.." page after the user is registered and logged in and looking at their acct. info.  I guess that's just me.

But I think if I did somehow have to extend a registration script past 1 page, pretty much do it the same as effigy.
Link to comment
Share on other sites

[quote author=Crayon Violent link=topic=108547.msg437308#msg437308 date=1158682021]
Also I have to kind of wonder why your registration process is taking more than one page to begin with? I personally think that ideally, a registeration script should be no more than one page to begin with.  Get the vitals, and that's it.  Anything else should be on some other "account preferences, settings, optional info, etc.." page after the user is registered and logged in and looking at their acct. info.  I guess that's just me. [/quote]

You could have two buttons. One saying 'Finish registration' and another one saying 'Enter more details'.
Link to comment
Share on other sites

well yeah, i can think of lots of reason why your registration [i]could[/i] have more than one page, but i'm just wondering why you [i]would[/i] do it. I'm not saying my methods are the best, but it just seems to me that the initial registration process should be as simple, fast and convenient as possible.  What exactly someone is registering [i]for[/i] plays an important factor in how long a registration form should be, obviously, but i personally feel that KISS should always be at the front of your mind.
Link to comment
Share on other sites

here is my register.php

default
    html form that submits to the next case

case check
    checks for html, ensures all fields are posted, ensures that email and username are unique, and ensures that the password matches the confirm password

  case register
  this page registers them in a database, creates their profile, sets their PM inbox up, and sends them an email

  case error
    any errors and stuff that is thrown is redirected here and other statements show the user his/her error, sends emails to admin, etc.
Link to comment
Share on other sites

I personally do not like to use includes.  I find that they make the code harder to read and follow, encourage the use of global variables, and in general are a PITA.  For multipage forms, I prefer to use a hidden page parameter and use this value to choose which page to display.
Link to comment
Share on other sites

Multiple pages requires duplicate code. Duplicate code requires more time. More time is less efficient. Less efficient is more cost. More cost is more expensive.

and for reference, you are describing the Front Controller, or Page Controller when you refer to 'using switches'

(and switch() is just one of many ways to achieve such a task)
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.