0

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

1
Contributor
1
Reply
15
Views
2 Years
Discussion Span
Last Post by UK-1991
0
<?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() . ")"
    );  
}
?>
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.