我正在尝试使用 redbeans 将数据从我的 Web 表单存储到数据库,但我无法使其工作。我已经确保数据库已连接。我正在为 web 和 sql 使用 apache xampp 服务器。这是我的代码
形式
<head>
</head>
<?php
require "validatecar.php";
?>
<body>
<form method="POST">
Model <input type="text" name="Model">
Manufacturing Company <input type="text" name="Company">
Pessenger Capacity <input type="number" name="Pessenger">
Luggage Capacty <input type="number" name="Luggage">
Doors <input type="number" name="Doors">
Transmission <input type="text" name="Transmission">
Stereo <input type="text" name="Stereo">
Air Conditioning <input type="text" name="AC">
Image <input type="file" name="Image">
<input type="submit" name="Submit">
</form>
</body>
证实
<?php
include "dbconnection.php";
?>
<?php
if(isset($_POST['Submit']))
{
$model = $_POST['Model'];
$company = $_POST['Company'];
$pessenger = $_POST['Pessenger'];
$luggage = $_POST['Luggage'];
$doors = $_POST['Doors'];
$transmission = $_POST['Transmission'];
$stereo = $_POST['Stereo'];
$ac = $_POST['AC'];
$image = $_POST['Image'];
$cars = R::dispense('cars');
$cars->model = $model;
$cars->company = $company;
$cars->pessenger = $pessenger;
$cars->luggage = $luggage;
$cars->doors = $doors;
$cars->transmission = $transmission;
$cars->stereo = $stereo;
$cars->ac = $ac;
$cars->image = $image;
R::store($cars);
R::close();
}
?>
如果您能告诉我我做错了什么以及如何解决它,那将非常有帮助。提前致谢。
GCT1015