我正在尝试通过html表单记录用户名,电子邮件和区域以及steamid
。
html表单在这里:
<form class="cptxt" action="/insert.php" method="post">
PUBG NAME: <input type="text" name="username" placeholder="Enter In Game
Name">
<br><br>
Email: <input type="text" name="email" placeholder="Enter Email"><br><br>
SteamID: <input type="text" name="sid" value="<?php echo
$steamprofile['steamid'] ?>" ><br><br>
SELECT REGION:
<select name="region">
<option value="NA">North America</option>
<option value="EU">Europe</option>
<option value="AS">Aisa</option>
<option value="OC">Oceianic</option>
</select> <br>
<br>
<input type="submit" value="Submit">
</form>
这是insert.php文件
<?php
require('connect.php');
include ('steamauth/userInfo.php');
if(!$con)
{
echo "NOT CONNECTED";
}
if(!mysqli_select_db($con,'pubgfinder'))
{
echo "db not selected";
}
$Name = $_POST['username'];
$Email = $_POST['email'];
$Sid = $_POST['sid']
$Region = $_POST['region'];
$sql = "INSERT INTO users (Name,Email,Region,Sid) VALUES
('$Name','$Email','$Region','$Sid')";
if(!mysqli_query($con,$sql))
{
echo "NOT INSERTED";
}
else
{
echo "INSERTED";
}
header("refresh:2; url=home.php");
?>
到目前为止,除了steamid
部分之外,我得到的是表格。它也将steamid
写入表单字段,但不发送到数据库
请帮忙。我写错了吗?这有什么问题?