数据未插入表

时间:2019-05-12 15:24:04

标签: php mysql

im试图将数据从另一个表插入到一个表中。但它只是一个正在插入的(employeeid)。它缺少在此处制作出勤表的(名字和姓氏)即时消息。我可以将代码提供给任何可以帮助的人。我该怎么办?即时消息对编码来说是新的。我正试图把这件事弄对。

<?php
session_start();
error_reporting(0);
include 'config.php';
if(isset($_POST['employeeid'])) {
    $employeeid=$_POST['employeeid']; 
    $ret=mysqli_query($con,"SELECT * FROM tbluser WHERE employeeid='$employeeid'");
    $num=mysqli_fetch_array($ret);
    if($num>0){
        $_SESSION['employeeid']=$employeeid; 
        $uip=$_SERVER['REMOTE_ADDR'];
        $action="Login";
        $sql=mysqli_query($con,"INSERT INTO attendance (employeeid, firstname, lastname, userIp, action) VALUES ('$employeeid', '$firstname', '$lastname', '$uip', '$action')");
        $extra="dash.php";
        $host=$_SERVER['HTTP_HOST'];
        $uri=rtrim(dirname($_SERVER['PHP_SELF']),'/\\');
        header("location:http://$host$uri/$extra");
        exit();
    }
    else
    {
        echo "<script>alert('Username or password is incorrect!')</script>";
        echo "<script>window.open('index.php','_self')</script>";     
    }
}
?>

这是我的html表单

<html>
<head>
  <meta charset="UTF-8">
  <title></title>
    <link rel="stylesheet" href="style.css" media="screen" type="text/css" />
<br><br><br><br><br><br><br><br><br><br><br><br><center><h1><b>WELCOME BRUH!‍</b></h1></center>
</head>
<body>
    <script>
    function clock() {
var time = new Date(),

    hours = time.getHours(),

    minutes = time.getMinutes(),

    seconds = time.getSeconds();

document.querySelectorAll('.clock')[0].innerHTML = harold(hours) + ":" + harold(minutes) + ":" + harold(seconds);

  function harold(standIn) {
    if (standIn < 10) {
      standIn = '0' + standIn
    }
    return standIn;
  }
}
setInterval(clock, 1000);
    </script>
    <div class="clock" style="font-family: 'Digital-7 Italic','Share Tech Mono', monospace; 
    font-size: 50px; color: #000000; 
    text-shadow: 0 0 20px rgba(255, 255, 255);  0 0 20px rgba(10, 175, 230, 0); 
    position: absolute;
    top: 200px;
    left: 685px;">
    </div>
        <div class="container">
        <div id="login">
            <fieldset class="clearfix">
            <form action="loginprocess.php" name="login" method="POST">

            <p><span class="fontawesome-barcode"></span><input type="text"  placeholder="EmployeeID" name="employeeid" required></p>
            <p><input name="submit" type="submit" value="Sign In"></p>

            </form>
            </fieldset>
                    <form>
                    <a href="admin.php">
                    <input type="submit2" value="ADMIN"/>
                    </a>
                    </form>                  
        </div>
        </div>
        </body>
        </html>

0 个答案:

没有答案