Jump to content

Meeting Attendance in PHP/MySql


danwilk

Recommended Posts

I have created a complete package for my church to use for members and meeting minutes, etc.. but I am having trouble designing a way to submit attendance at our monthly conference meeting. I have designed a member database in MySQL where the unique key is auto generated number and I want to design something like a PHP page that lists the members and I can select them with a check box or something and it update the Attendance table. I'm not sure how to handle that part of the design. I think I might be able to write some inquiries to join the member table and the attendance tables once I get over this hurdle.

Any help is appreciated.

Thanks,
Daniel
Link to comment
https://forums.phpfreaks.com/topic/4091-meeting-attendance-in-phpmysql/
Share on other sites

Three tables

Member
---------
memberID | name | etc


Meeting
----------
meetingID | meeting_name | meeting_date


Attendance
---------------
attID
meetingID
memberID

So for each person at each meeting there is a record in the attendance table.

Have form (generate from member table) like this where checkbox value is the memberID of the member

[code]<FORM method='POST'>
<INPUT TYPE='TEXT'  name='attend[]' value='1'> Adam
<INPUT TYPE='TEXT'  name='attend[]' value='2'> Ben
<INPUT TYPE='TEXT'  name='attend[]' value='3'> Cath
<INPUT TYPE='SUBMIT'  name='submit' value='Submit'>
</FORM>[/code]

Then to process

[code]if (isset($_POST['submit'])) {
    foreach($_POST['attend'] as memberID) {
            // add record to attendance table
    }
}[/code]
Barand,
I got the form to work with the checkboxes and MbrId's but for some reason I think I don't have the form processing logic correct, can you take a look? Attid is auto incremented and instead of meeting id I am using the meeting date since I am tracking only one type of meeting.

[code]
<?
$link = mysql_connect("localhost","root","pass");

mysql_select_db("dbname",$link);

$query=("insert into ConfAttendance(mbrid,confdate) or die(mysql_error())");

if (isset($_POST['submit'])){
for each($_POST['attend'] as Mbrid),($_POST['meetdate'] as confdate) {
mysql_query($query);
}
}
?>
[/code]




[!--quoteo(post=351811:date=Mar 5 2006, 07:16 AM:name=Barand)--][div class=\'quotetop\']QUOTE(Barand @ Mar 5 2006, 07:16 AM) [snapback]351811[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Three tables

Member
---------
memberID | name | etc
Meeting
----------
meetingID | meeting_name | meeting_date
Attendance
---------------
attID
meetingID
memberID

So for each person at each meeting there is a record in the attendance table.

Have form (generate from member table) like this where checkbox value is the memberID of the member

[code]<FORM method='POST'>
<INPUT TYPE='TEXT'  name='attend[]' value='1'> Adam
<INPUT TYPE='TEXT'  name='attend[]' value='2'> Ben
<INPUT TYPE='TEXT'  name='attend[]' value='3'> Cath
<INPUT TYPE='SUBMIT'  name='submit' value='Submit'>
</FORM>[/code]

Then to process

[code]if (isset($_POST['submit'])) {
    foreach($_POST['attend'] as memberID) {
            // add record to attendance table
    }
}[/code]
[/quote]
[code][/code]
[code]<?
$link = mysql_connect("localhost","root","pass");

mysql_select_db("dbname",$link);


if (isset($_POST['submit'])){
    $confdate = $_POST['meetdate'];
    for each($_POST['attend'] as $mbrid)) {
        $query=("insert into ConfAttendance(memberID, confdate) VALUES($mbrid,'$confdate') ");
        mysql_query($query) or die(mysql_error());
    }
}
?>[/code]

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.