Jump to content
Larry Ullman's Book Forums

Using Checkboxes And Names From A Mysql Table For Attendance.


Recommended Posts

I am using the structure of Script 3.5 (Calculator.php) to tackle the issue of recording attendance for persons listed in a MySQL database.  I am using this structure because I am attempting to create a web page that will handle a form and then display it again.  Larry mentions this function on page 86.

I plan to use input type="checkbox" name="checkbox[]" value="full_name".  The value part is where I am having trouble.  I want to select a person's name from a table in the database so that the name will appear on the form on the same line with the checkbox.

 

The page is in two parts, the first part being for php code, and the second part being for the html form.  To place on the form a checkbox I need to list a person's name with that input.  I can query the database in the php section and fetch from the array of results each person's name.

Can anyone suggest where in the code I can fetch the names and then use them in the input for checkboxes?

 

I hope this makes sense.  I want to record attendance for all persons in a table who are present at a meeting.  I want to list the names of all persons in the table along with a checkbox that can be checked to indicate they were present.

 

I will appreciate any guidance that can be shared to help me in designing a plan to accomplish this.

 

Thank you.

 

Wes (wesmith4@gmail.com)

Link to comment
Share on other sites

I would do the SELECT query just before the HTML form. I'd display the names but use the user ID from the table (or whatever primary key) as the value of the checkboxes. Also, if you keep reading, there will be examples closer to this (that both display and handle a form, but use a database as the source). 

Link to comment
Share on other sites

 Share

×
×
  • Create New...