Hello Guys I am trying to create an attendace system for that I went throught a simple and easiest process which I was thinking is good way but any one cacn let me know where I am doing mistake that when I click on timein the values are not insterting in the database.

Database structure:

pre_id      timein       p_date
Auto Inc    time          date




    $user_id = 2;
    $date   = date('y-m-d');
    $timein = $_POST['timein'];

        $query = mysql_query("insert into presence(user_id, timein, p_date) 
        values('$user_id', '$timein', '$date')");

        header("Location: ../home.php");


<?php $time = date('h:i:s'); ?>

<form action="includes/insert_presence.php" method="POST">
    <input type="submit" value="TIME IN" name="time_in" class="time" />

    <div class="clear"></div>
    <input type="hidden" name="timein" value="<?php echo $time; ?>" />
    <p><?php echo date('h:i:s A'); ?></p>

Please help me out with this consirn


define ("DB_SERVER", "localhost" );
define ("DB_USER"  , "root"      );
define ("DB_PASS"  , ""          );
define ("DB_NAME"  , "attendance1");

$connection = mysqli_connect(DB_SERVER, DB_USER, DB_PASS, DB_NAME);

if(mysqli_connect_errno()) {
    die("SQL Connection Failed: " .
        mysqli_connect_error() .
        "(" . mysqli_connect_errno() . ")"