<!DOCTYPE html>
<html>
<!--Title-->
<title>Saint Services</title>
<!--Links-->
<link rel="stylesheet" href="style.css">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-4bw+/aepP/YC94hEpVNVgiZdgIC5+VKNBQNGCHeKRQN+PtmoHDEXuppvnDJzQIu9" crossorigin="anonymous">
<script src="code.js"></script>
</head>
<body>
<header class="nav">
<div class="mb-4 logo">
<logo><img src="images\logo-sac.png" width="50" length="50" alt="logo"></logo>
</div>
<div class="home">
<links><a href="test.html"><img src="images\home.png" width="75" length="75" alt="home"></a></links>
</div>
<div class="settings">
<links><a href="style.css"><img src="images\cog.png" width="75" length="75" alt="settings"></a></links>
</div>
<div class="profile">
<links><a href="login.php"><img src="images\person.png" width="75" length="75" alt="person"></a></links>
</div>
<div class="donations">
<links><a href="donate.php"><img src="images\donate.png" width="75" length="75" alt="donations"></a></links>
</div>
</header>
<br>
<div class="section">
<div class="container">
<div class="row full-height justify-content-center">
<div class="col-12 text-center align-self-center py-5">
<div class="section pb-5 pt-5 pt-sm-2 text-center">
<h6 class="text"><span>Log In </span><span>Sign Up</span></h6>
<input class="checkbox" type="checkbox" id="reg-log" name="reg-log"/>
<label for="reg-log"></label>
<div class="card-3d-wrap mx-auto">
<div class="card-3d-wrapper">
<div class="card-front">
<div class="center-wrap">
<div class="section text-center">
<form action="login.php" method="post">
<text><h4 class="text mb-4 pb-3">LOG IN</h4></text>
<div class="form-group">
<input type="email" name="EMAIL" class="form-style" placeholder="*Email" id="logemail" autocomplete="off">
<i class="input-icon uil uil-at"></i>
</div>
<div class="form-group mt-2">
<input type="password" name="PASSWORD" class="form-style" placeholder="*Password" id="logpass" autocomplete="off">
<i class="input-icon uil uil-lock-alt"></i>
</div>
<a type="submit" href="donate.php" class="btn mt-4">SUBMIT</a>
<p class="mb-0 mt-4 text-center"><a href="" class="link">Forgot your password?</a></p>
</div>
</div>
</div>
<div class="card-back">
<div class="center-wrap">
<div class="section text-center">
<text><h4 class="text">SIGN UP</h4></text>
<form action="test.php" method="post">
<div class="form-group">
<input type="text" name="FIRST_NAME" class="form-style" placeholder="*First Name" id="FIRST_NAME" autocomplete="off">
<i class="input-icon uil uil-user"></i>
</div>
<div class="form-group mt-2">
<input type="text" name="SURNAME" class="form-style" placeholder="*Surname" id="SURNAME" autocomplete="off">
<i class="input-icon uil uil-user"></i>
</div>
<div class="form-group mt-2">
<input type="text" name="MOBILE_NUMBER" class="form-style" placeholder="*Phone Number" id="MOBILE_NUMBER" autocomplete="off">
<i class="input-icon uil uil-user"></i>
</div>
<div class="form-group mt-2">
<input type="email" name="EMAIL" class="form-style" placeholder="*Email" id="EMAIL" autocomplete="off">
<i class="input-icon uil uil-at"></i>
</div>
<div class="form-group mt-2">
<input type="password" name="PASSWORDS" class="form-style" placeholder="*Password" id="PASSWORDS" autocomplete="off">
<i class="input-icon uil uil-lock-alt"></i>
</div>
<div class="form-group mt-2">
<input type="password" name="CONFIRM_PASSWORD" class="form-style" placeholder="*Confirm Password" id="CONFIRM_PASSWORD" autocomplete="off">
<i class="input-icon uil uil-lock-alt"></i>
</div>
<a type="submit" class="btn mt-4" onclick="return signinValid()">SUBMIT</a>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
<footer>
<div class="mb-4 logo">
<logo><img src="images\logo-sac.png" width="50" length="50" alt="logo"></logo>
<p>Name</p>
</div>
<?php
//PHP
//Connection to database
require("login.php");
//Signup
$conn = new mysqli("localhost","admin","30:]thrib#day*01$2007","fa3") or die(mysqli_error($conn));
if(isset($_POST["submit"])){
$fname = $_POST["FIRST_NAME"];
$lname = $_POST["SURNAME"];
$mobile = $_POST["MOBILE_NUMBER"];
$email = $_POST["EMAIL"];
$pass = $_POST["PASSWORDS"];
$cpass = $_POST["CONFIRM_PASSWORD"];
}
$query = mysqli_query($conn,"INSERT INTO users VALUES(FIRST_NAME, SURNAME, MOBILE_NUMBER, EMAIL, PASSWORDS, CONFIRM_PASSWORDS)
VALUES($fname, $lname, $mobile, $email, $pass, $cpass)") or die(mysqli_error($conn));
//Login
?>
代码将变量 $fname、$lname、$mobile、$pass、$cpass 读取为变量中的未定义,然后出现致命错误。 php 位于另一个名为 test.php 的页面上。我的老师建议将它放在两个不同的页面上,以确保 php 不会“混乱”。我不关心验证,因为我使用了 Javascript。这是我最后的手段,明天到期。
警告:第 23 行C:\xampp\htdocs\ds est.php
中未定义变量 $fname警告:第 23 行C:\xampp\htdocs\ds est.php
中未定义变量 $lname警告:第 23 线上 C:\xampp\htdocs\ds est.php
中未定义变量 $mobile警告:第 23 线上 C:\xampp\htdocs\ds est.php
中未定义变量 $email警告:第 23 行上的 C:\xampp\htdocs\ds est.php
中未定义变量 $pass警告:第 23 线上 C:\xampp\htdocs\ds est.php
中未定义变量 $cpass致命错误:未捕获 mysqli_sql_Exception:您的 SQL 语法有错误;检查与您的 MariaDB 服务器版本相对应的手册,了解在 C:\xampp\htdocs\ds est.php:22 中第 2 行的“VALUES(, , , , , )”附近使用的正确语法:#0 C :\xampp\htdocs\ds est.php(22): mysqli_query(Object(mysqli), 'INSERT INTO use...') #1 {main} 放入 C:\xampp\htdocs\ds est.php上线22
了解正在发生的情况的方法是在 PHP 文件的第一行上执行
print_r('$_POST')
操作,并检查 PHP 中通过 Post 到达的所有内容,在后面添加 exit;
以使代码停止执行。将结果粘贴到此处。