我的表单没有向 mySQL 数据库发送数据。为什么?

问题描述 投票:0回答:0
<?php
require_once('conn1.php');
if (isset($_POST['submit'])){

    $username = $_POST['username'];
    $firstname = $_POST['first_name'];
    $lastname = $_POST['last_name'];
    $gender = $_POST['gender'];
    $pw = $_POST['password'];

    $value = "INSERT INTO user_details(username, first_name, last_name, gender, password) VALUES('$username', '$firstname', '$lastname', '$gender','$pw') ";
    $check = mysqli_query($conn, $value);

    if ($check) {
        echo "<script>alert('Your Form Is Submit Successfully !');</script>";
    } else {
        echo "<script>alert('Something Went Wrong !');</script>";
    }

    mysqli_close($conn);
}

?>

但是表单数据没有保存在数据库中

php sql database mysqli
© www.soinside.com 2019 - 2024. All rights reserved.