danwilk Posted March 4, 2006 Share Posted March 4, 2006 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 Quote Link to comment https://forums.phpfreaks.com/topic/4091-meeting-attendance-in-phpmysql/ Share on other sites More sharing options...
Barand Posted March 5, 2006 Share Posted March 5, 2006 Three tablesMember---------memberID | name | etcMeeting----------meetingID | meeting_name | meeting_dateAttendance---------------attIDmeetingIDmemberIDSo 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 Link to comment https://forums.phpfreaks.com/topic/4091-meeting-attendance-in-phpmysql/#findComment-14376 Share on other sites More sharing options...
danwilk Posted March 5, 2006 Author Share Posted March 5, 2006 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 tablesMember---------memberID | name | etcMeeting----------meetingID | meeting_name | meeting_dateAttendance---------------attIDmeetingIDmemberIDSo 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] Quote Link to comment https://forums.phpfreaks.com/topic/4091-meeting-attendance-in-phpmysql/#findComment-14391 Share on other sites More sharing options...
Barand Posted March 5, 2006 Share Posted March 5, 2006 [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] Quote Link to comment https://forums.phpfreaks.com/topic/4091-meeting-attendance-in-phpmysql/#findComment-14450 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.