I have a form for saving the attendance of students to the MySQL database.
Students' data is read from the database and create the data entry form.
The form is designed to store the code, name, presence status of each student and a short description in case of absence.
I have designed the data entry form, but seem to need some clues regarding the save action so that clicking on each save button, the appropriate data is stored in the attendance table of the database.A screenshot of the form
1 Answer 1
If you don't care about old IE (which has bugs in its support of <button>, I think version 7 fixes this those bugs) then (making sure you are in Standards mode):
<button type="submit" name="row_id" value="insert row id here">Save</button>
$row_id = $_POST['row_id'];
If you do care about old IE:
<input type="submit" name="row_id_row_id_here" value="Save">
and loop over the keys in $_POST looking for ones which match the regex /^row_id_(.*)/.
2 Comments
$('.save-button-class').on('click', function(e) { alert('saving row with id' + $(this).attr('name')); $.post('...'); });