"binger" <ma************ *****@yahoo.com > wrote in message
news:69******** *************** ***@posting.goo gle.com...
Okay,
Superbowl is only a few days away, but I thought it would be cool to
set up an online registration for a football squares pool.
My thoughts are to have people go into anywhere on the 10x10 matrix
and put their name in.
If someone already has put their name in a square, then the text input
box is now static (i.e. cant be overwritten)...
Only problem - I'm not sure how to do this. I'd plan on using an
access database with ASP...but was wondering if anyone has quick
thoughts (or maybe actual working code)...on how to do this???
Would the database be best served with 100 rows of data (1 for each
square), or 1 row with 100 columns of data...??? thoughts?
Thanks!
Go Pats...
As this is just a small application with very little need for expandability,
the FASTEST way to do it might be to start by creating your grid as static
HTML. That is, create an HTML table (enclosed in a form), which has 11 rows
and 11 columns (don't forget, you need an extra row to hold the numbers
along the top of the grid, and an extra column to hold the numbers along the
left side of the grid). Your database should contain 100 rows of data
because you will need an ID column (which will be used to to identify the
items in the form) and a text column to store the name (which should be
empty to begin with). Your page should get all of the records from the
database into a recordset (ordered by the ID field). This example assumes
your ID field is numbered sequentially from 1 to 100 (that's important).
Then, for each table cell, you will write your input. If the length of the
name field for the corresponding record in the database is greater than
zero, make the field readonly. For example:
<td><%
Response.Write "<input name=""square" & RS("ID") & """ type=""text""
maxlength=""50" " size=""12"" value=""" & RS("PersonName" ) & """"
If Len(RS("PersonN ame")) > 0 Then
Response.Write " readonly"
End If
Response.Write ">"
RS.MoveNext()
%></td>
After the grid, include a submit button to post the form to a 2nd page for
processing and updating the database, and then redirect back to the original
grid page when done. If there will only be 1 computer accessing this page,
then you don't need to do any "validation ", but if multiple computers may be
used to access and update this grid, then you'll need to check that the name
value is still empty in the database before updating (otherwise, Tom and
Dick might both load the grid at the same time and both enter values into a
field... Tom submits and he sees his value is added to the grid... then Dick
submits and overwrites Tom's entry... smells like foul play).
This is a quick and dirty approach, but I hope this helps get you going in
the right direction. :)
Regards,
Peter Foti