I've updated the attendance.sql and the attendance form (index.php) by adding the time in and time out of the attendance.
The time in and time out values are still blank even it is assigned in the database. (Lines 65 - 66)

And when I tried to update the values (e.g. present and late), it cannot work. (Line 89)

Can help me?

Download: https://drive.google.com/open?id=0B07_pOHhTox3aEtCZm9TVjVkTlk
Inside there is the database table called attendance.sql. You need xampp and you must import the table (attendance.sql) in phpmyadmin.

Hello? Anyone can help me?

You seem to be asking for someone to either have the setup you have, or create then load up your system and debug it for you. That's probably why you haven't seen a reply.

Why not share the few lines that seem to not work, tell us why you think it doesn't and see what happens?

Because it's connected to the mysql database.

Lines 65 - 66 of index.php

<td><input type="time" name="timeIn" id="timeIn" <?php echo $row['timeIn'] > 0 ? ' time':''; ?>></td>
<td><input type="time" name="timeOut" id="timeOut" <?php echo $row['timeOut'] > 0 ? ' time':''; ?>></td>

Lines 85 - 110 (index.php)

<?php

// Start updating process

$query = "SELECT * FROM `attendance` WHERE `id`='$id'";
$query_run = mysql_query($query);

if (isset($_POST['present']) && isset($_POST['late']) && isset($_POST['timeIn']) && isset($_POST['timeOut']) && isset($_POST['remarks']))
{
    $present = $_POST['present'];
    $late = $_POST['late'];
    $remarks = $_POST['remarks'];
    $timeIn = $_POST['timeIn'];
    $timeOut = $_POST['timeOut'];

    $query = "UPDATE `attendance` SET `present`= '".mysql_real_escape_string($present)."',`late`= '".mysql_real_escape_string($late)."', `timeIn`= '".mysql_real_escape_string($timeIn).";, `timeOut`= '".mysql_real_escape_string($timeOut).";, `remarks`= '".mysql_real_escape_string($remarks)."' WHERE `id` = '$id' ";
    if ($query_run = mysql_query($query))
    {
        echo 'Updated successfully.';
    }
    else
    {
        echo 'Sorry, we couldn\'t update at this time. Try again later.';
    }
}
?>

Hi,

I think you're confused by my previous post. The input type time is not boolean, so to see the value you must set it in the value attribute, so instead of:

<td><input type="time" name="timeIn" id="timeIn" <?php echo $row['timeIn'] > 0 ? ' time':''; ?>></td>

Do:

<input type="time" name="timeIn" id="timeIn" value="<?php echo is_null($row['timeIn']) === FALSE ? $row['timeIn']:''; ?>">

Your previous approach works if you're using a input types like checkbox, radio with the checked attribute or select tags with the selected attribute.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.