我正在尝试创建一个oop登录系统并且卡在这个
上Soo,这是我的插入类
include_once 'db.php';
class loginHandler extends db {
private $login;
private $password;
private $email;
private $stmt;
public function __construct ($l,$p,$e) {
$this->login = $l;
$this->password = $p;
$this->email = $e;
$this->stmt = $this->connect()->prepare("INSERT INTO users (log,pwd,email) VALUES (?,?,?);");
}
public function send () {
$this->stmt->execute([$this->login,$this->password,$this->email]);
}
}
这就是提交按钮的位置
include 'loginHandler.php';
$log = $_POST['log'];
$pwd = $_POST['pwd'];
$em = $_POST['email'];
$buffer = new loginHandler ($log,$pwd,$em);
$buffer->send();
因此,当它运行时,表字段填充“NULL”而不是输入中的实际数据
答案 0 :(得分:0)
您需要在_POST
之前添加$ sign$log = $_POST['log'];
$pwd = $_POST['pwd'];
$em = $_POST['email'];