binumathew Posted March 6, 2009 Share Posted March 6, 2009 Friends, Think that there is 50 students in the class.....i like to make a attence application for them....i am thinking of using Check Box for nice functioning of the App....What i mean is .... i will list 50 names and there will be a check box....if the teacher click on the check box then the student will mark as absent...am i need to write so much mysql connection and querey for doing this??whats your suggestion??can u gave me a code sample at the same time.....can you tell me how we can post a data from the checked box Link to comment https://forums.phpfreaks.com/topic/148249-solved-check-box-mysql-data-base-and-php/ Share on other sites More sharing options...
binumathew Posted March 6, 2009 Author Share Posted March 6, 2009 <form action="" method="post"> <input type="checkbox" name="absent[]" value="1"> student #1<br> <input type="checkbox" name="absent[]" value="2"> student #2<br> <input type="checkbox" name="absent[]" value="3"> student #3<br> <input type="checkbox" name="absent[]" value="4"> student #4<br> <input type="checkbox" name="absent[]" value="5"> student #5<br> <input type="submit" name="submit" value="submit"> </form> <?php if (isset($_POST['submit'])) { if (isset($_POST['absent'])) { foreach ($_POST['absent'] as $value) { $sql = 'INSERT INTO absent_table set date = NOW(), student_id = ' . $value; echo $sql . '<br>'; } } else { echo 'everybody made it to class, yay'; } } ?> solution i got Link to comment https://forums.phpfreaks.com/topic/148249-solved-check-box-mysql-data-base-and-php/#findComment-778336 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.