Try the following query to insert absent students into attend table on a button click:
'Day_date: 2022-01-17 is the control date on which you are performing action. You can pass the parameter to run this query'
SQL Query:
INSERT INTO attend
SELECT Id, Number, fullName, 'absent', '2022-01-17'
FROM student
WHERE Id NOT IN (SELECT Stu_id FROM attend WHERE Day_date = '2022-01-17')
MySQL Query:
INSERT INTO attend
SELECT Id, Number, fullName, 'absent', '2022-01-17'
FROM student
WHERE Id NOT IN (SELECT Stu_id FROM attend WHERE Day_date = '2022-01-17')