Log in

View Full Version : Remember a check box form?



BLiZZaRD
06-08-2006, 08:39 AM
Hello everyone...

I have a weird idea I want to try to impliment over the next couple months.. I had the idea, and now I am at the point I am ready to start it.

What I have so far is a basic php/SQL log in. Easy enough. The member comes to the site, logs in with their username and password and gets taken to their personal default page.

What I want, it this default page to be a sort of... how to put this... series of check boxes.

Okay, let me try to explain this (as I don't have a page to show you)...

I have 400 pages for the members to view. They can only view one at a time. Each page has 4 input boxes and 4 submit bttons.

So if they are on page 1, they enter the "password" in the Red Box, and it is correct, they will be taken to red page 56. From Red Page 56 they enter the password for the Blue box. This takes them to Blue page 12... on and on and on...

I have all of this worked out and it all works beautifly (so far). HOWEVER!

The problem I have is that there is no way the member will see all the pages in one day.

So I want to make the log in page show the pages they have seen and the last one they were on. This way, when they log in, they see a check mark next to page 1, a check mark next to Red Page 56 and the text for Blue page 12 is a different color, but not checked (this is the last page they were on.)

They can review this page, and when they click the "Go!" button it takes them to Blue Page 12, and they can continue their viewing.

The reason for this is that each and every page will have a "random" file name. So red page 56 will really be Hu34Fgt.php

Which makes it basically impossible for them to get to the page any other way.

I have thought about using cookies, but if they clear their cache, they would have to start all over...

So, if I explained that well enough, is there any help you can offer?

Just to clarify, on this check box/log in page the ONLY interaction by the member is to click the "Go!" button.

Thanks!

~BLiZZ

djr33
06-08-2006, 05:23 PM
You're already using mysql/php... just add a row to the members' table to remember their "last page"

Easy, right?

BLiZZaRD
06-09-2006, 07:08 AM
Yeah, that part I figured out... but that only stores the last page.

I still need a way to store all pages they have "completed" and show this to them some how.

With 400 pages, each time the log in, they wont necc. remember all the ones they have been too, more over, not wanting to restart each time.

This is why I designed (in my head) an "auto-matic" check box page. This page would show all 400 page titles.

So using the example above:


RED PAGES BLUE PAGES GREEN PAGES
[x]Page 1 [ ]Page 1 [x]Page 1
[ ]Page 2 [ ]Page 2 [ ]Page 2
[]Page 3 [x]Page 3 [x]Page 3


So this would all be done by the php/mysql The [x]'s would be added to pages they have completed and the red text is the last page they were on.

I am probably not saying this right... I know what I mean... LOL

~BLiZZ

mwinter
06-09-2006, 10:36 AM
One solution is simple enough, though it will be laborious to set up.

As the user logs in, I presume that each has their own record in a database, hopefully using the username or e-mail address as primary key. Perhaps something like:

user(firstname, surname, e-mail, password)

You'd need to create two more relations (tables). The first contains a list of all of the pages a user might visit (that's the distinctly tedious part), perhaps including a friendly description or summary:

page(url, description)

The second is the link entity between the two, recording when the user progressed to a particular page:

progress(user*, page*, time)

When the user moves to a particular page, a new tuple is added to the progress relation, recording the time and date of that access. To retrieve their history, you'd simply select on the username (or e-mail, in this case, which has the same function) and sort by access time.

SELECT url, time, description FROM progress, page
WHERE progress.user=<current-user> AND progress.page=page.url
ORDER BY time DESC

If you sort in descending order, the first result will be the incomplete page, and each successive result will go further back through their history.

If you want to list all of the pages, then you could use an outer join, instead where a null time field would represent unvisited pages. Displaying all of them would complicate things somewhat, though, as you'd probably want to sort the unvisited pages by some predefined means (which would mean altering page relation to include some sortable identifier, unless the URL sufficed).


I wouldn't use checkboxes. Form controls represent interaction for the user (something for them to select or type), not unchangable state. I would use images instead: a tick mark for completed pages (with 'Completed' as alt text), and a cross for the incomplete one ('Incomplete'). Unvisited pages, if displayed, might also complicate this - I don't know if they should take the cross with the incomplete page left with no indicator, or visa versa. Perhaps a question mark for the incomplete one in both cases?

Hope that's something useful for you to think about.
Mike

BLiZZaRD
06-10-2006, 07:01 AM
thanks a ton for that Mike!

With over 400 pages *anything* I do on this is going to be long and tedious :D

I understand what you say about the check boxes, and I like the check marks and ? option better...

I will go write up some stuff here and see what I can do. I will try it 5 or 10 pages first and then get it to work...

Maybe I will come here for beta testers??? LOL

Thanks again!

~BLiZZ

djr33
06-10-2006, 07:23 AM
Yeah, that will do it. Sure, i'd probably test it.

BLiZZaRD
06-11-2006, 06:56 AM
Alrighty, thanks djr! I will hold you to that, LOL.

Like my first post said though, I have about 2 months or so. I have a few other small projects that this has to take a back seat to first, but I am working on it slowly and steadily.

(learning MySQL as I go too... **yikes** )

~BLiZZ