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

Insert_presence.php

<?php 
    error_reporting(0);

    include_once('connection.php');
    date_default_timezone_set("US/Arizona");

    $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");
?>

timein.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>
</form>  

Please help me out with this consirn

<?php

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() . ")"
    );  
}
?>
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.