我正在尝试创建一个PHP页面,该页面显示数据库中的信息,并且可以通过单击“批准”按钮进行更新。我收到了数据库中的信息(名字,姓氏,请求)。我的问题是,当我单击“批准”按钮时,我收到404页面未找到错误,并且数据库也未更新。任何帮助,将不胜感激。
第一个cgi文件名为ApproveDenyPrayerRequest
<?php
$username="XXXXX";
$password="XXXXX";
$database="XXXXX";
$link = mysqli_connect('XXXXX', $username, $password, $database);
if (!$link) {
die('Connect Error (' . mysqli_connect_errno() . ') '. mysqli_connect_error());
}
$query = "SELECT * FROM Request";
$result = mysqli_query($link,$query); //<----- Added link
$row = mysqli_fetch_array($result);
?>
<form method="post" action="PrayerRequest.php" />
<table>
<tr>
<td>First Name:</td>
<td><input type="text" name="first" value="<? echo "$row[Reg_F_Name]" ?>"></td>
</tr>
<tr>
<td>Last Name:</td>
<td><input type="text" name="last" value="<? echo "$row[Reg_L_Name]" ?>"></td>
</tr>
<tr>
<td>Prayer Request</td>
<td><input type="text" name="phone" value="<? echo "$row[Reg_Request]" ?>"></td>
</tr>
</table>
<input name="add" type="submit" id="add" value="Approve Prayer Request">
</form>
这是名为PrayerRequest的第二个文件。
<?php
$username="XXX";
$password="XXXXX";
$database="XXXXX";
$link = mysqli_connect('XXXXX', $username, $password, $database);
if (!$link) {
die('Connect Error (' . mysqli_connect_errno() . ') '. mysqli_connect_error());
}
echo 'Success... ' . mysqli_get_host_info($link) . "\n";
$query = "SELECT * FROM Request";
$query2="INSERT INTO Request (Reg_F_Name,Reg_L_Name,Reg_Request)
VALUES ( '$row[Reg_F_Name]', '$row[Reg_L_Name]', '$row[Reg_Request]' )";
$result = mysqli_query($query);
$row = mysqli_fetch_array($result);
?>
<form method="post" action="ApproveDenyPrayerRequest.php" />
<table>
<tr>
<td>First Name:</td>
<td><input type="text" name="first" value="<? echo "$row[Reg_F_Name]" ?>"></td>
</tr>
<tr>
<td>Last Name:</td>
<td><input type="text" name="last" value="<? echo "$row[Reg_L_Name]" ?>"></td>
</tr>
<tr>
<td>Prayer Request</td>
<td><input type="text" name="phone" value="<? echo "$row[Reg_Request]" ?>"></td>
</tr>
</table>
</form>