gpt4 book ai didi

mysql - PHP 从 HTML 字段获取数据

转载 作者:行者123 更新时间:2023-11-29 13:23:43 24 4
gpt4 key购买 nike

我在从 HTML 字段获取数据时遇到一些问题。这就是它在 HTML 中的样子

<form action="getInfo.php">
<span>Series</span>
<input class="searchFieldAlign" type="text" name="seriesName" /><Br>

<span>Volume</span>
<input class="searchFieldAlign" type="text" name="volumeName" /><Br>

<span>Nr</span>
<input class="searchFieldALign" type="text" name="issueNR" /><Br>

<p input class="searchFieldALign" type=submit></p>
</form>

这是我的 php 脚本:

<?php
$seriesName = mysqli_real_escape_string($conn, $_POST['seriesName']);
$volumeName = mysqli_real_escape_string($conn, $_POST['volumeName']);
$issueNR = mysqli_real_escape_string($conn, $_POST['issueNR']);
$con=mysqli_connect("localhost","user","psswd","db");

// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$qryIssueInfo = mysqli_query($con,"select issueNR, issueVolume, issueName, issueImageURL from issue, series where (seriesName='$seriesName') and (issueVolume='$volumeName') and (issueNR=$issueNR)");
$rowIssueInfo = mysqli_fetch_array($qryIssueInfo);

问题是我没有从查询中获得输出。如果我把它改成这样就没有问题了:

$qryIssueInfo = mysqli_query($con,"select issueNR, issueVolume, issueName, issueImageURL from issue, series where seriesName='Buffy, the Vampire Slayer' and issueVolume= 'Season 8' and issueNR=1");

最佳答案

如果你没有设置表单方法=“post”,它将是“get”,你应该$_GET。

更正:

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

放轻松

关于mysql - PHP 从 HTML 字段获取数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20427657/

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