gpt4 book ai didi

php - 插入PHP表单数据不发送到MySQL服务器

转载 作者:行者123 更新时间:2023-11-29 12:37:18 27 4
gpt4 key购买 nike

我是一名业余 Web 开发人员,正在学习 php 和 mysql,因此我可能会将 php/html 表单数据发送到 sql 服务器。不幸的是,当我在 Web 服务器上运行该程序并单击提交按钮时,sql 服务器不会检索我在表单中输入的数据。我一直在尝试很多尝试。任何帮助将不胜感激。

<!DOCTYPE>
<html>
<head>
<title>Business Therapy</title>
</head>
<body bgcolor="ba2e2e">
<h1><center>Welcome To The Therapy of Business</center></h1>

<?php
if (isset($_POST['submit'])){

$con = mysql_connect ("194.81.104.22", "xxxxx", "xxxx");

if (!$con) {
die("Cannot connect : " . mysql_error());
}

mysql_select_db ("db12408543",$con);

$sql = "INSERT INTO Business (idBusiness, Name, Description, Time, Date, Location, Room, Speakers) VALUES ('$_POST[idBusiness]','$_POST[Name]','$_POST[Description]','$_POST[Time]','$_POST[Date]','$_POST[Location]','$_POST[Room]','$_POST[Speakers]')";

mysql_query($sql,$con);

mysql_close($con);
}
?>
<h3>Create A Seminar</h3>
<form action="adding.php" method"post">
idBusiness: <input type="text" name="idbusiness"><br />
Name: <input type="text" name="name"><br />
Description: <textarea name="description"></textarea><br />
Time: <input type="text" name="time"><br />
Date: <input type="text" name="date"><br />
Location: <input type="text" name="location"><br />
Room: <input type="text" name="room"><br />
Speakers: <input type="text" name="speakers"><br />
<input type="reset" name="reset">
<input type="submit" name="submit" value="Submit">




</form>


</body>

最佳答案

您有一个拼写错误,请更改:

<form action="adding.php" method"post">

对此:

<form action="adding.php" method="post">

关于php - 插入PHP表单数据不发送到MySQL服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26576131/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com