這是我的etaNavServer.php
文件。這些是我必須插入數據庫的值。我的表名是user
,數據庫名是srilanka
,這些是我必須插入的值。通過PHP將表格值插入到數據庫中
<?php if(isset($_POST['continue']))
{
$eta_type = $_POST['eta_type'];
$lastname = $_POST['lastname'];
$firstname = $_POST['firstname'];
$title1=$_POST['title1'];
$sql="INSERT INTO user(applicationtype,surname,givenname,title,) VALUES
('$eta_type','$lastname','$firstname','$title1')";
$query = mysqli_query($con, $sql);
if($query){
echo "<h4 style='color:green'>Services Added Successfully.</h4>";
}
else
{
echo "Failed";
}
}
connection.php
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "srilanka";
$con = new mysqli($servername, $username, $password, $dbname);
?>
有啥你的問題 –
發生了什麼?你剛纔描述了你的代碼,但是沒有遇到你遇到的問題 – Swellar
在'connection.php'中後面的'}是否是一個錯字? – Swellar