Jump to content

[SOLVED] Check Box ,MYSQL Data Base and PHP


binumathew

Recommended Posts

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

<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

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.