Jump to content

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]
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.