Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/294.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/87.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
注意:未定义的变量:第15行的C:\wamp\www\COP3718\tt2^homas12\delete.php中的Lastname_Php_Html_Mysql - Fatal编程技术网

注意:未定义的变量:第15行的C:\wamp\www\COP3718\tt2^homas12\delete.php中的Lastname

注意:未定义的变量:第15行的C:\wamp\www\COP3718\tt2^homas12\delete.php中的Lastname,php,html,mysql,Php,Html,Mysql,我正在尝试创建一个数据库,在表中我有两个选项,insert和delete。我有插入选项,但无法让删除功能为我工作。(我需要插入一个更新选项,一旦我有这个工作)我包括我的代码,并希望有人会看到我的错误在这方面,我已经为这个项目完成了两个星期了。先谢谢你 <!DOCTYPE html> <html> <body> <h1>Franchise Call Log</h1> <?php $con=mysqli_connect("loc

我正在尝试创建一个数据库,在表中我有两个选项,insert和delete。我有插入选项,但无法让删除功能为我工作。(我需要插入一个更新选项,一旦我有这个工作)我包括我的代码,并希望有人会看到我的错误在这方面,我已经为这个项目完成了两个星期了。先谢谢你

<!DOCTYPE html>
<html>
<body>


<h1>Franchise Call Log</h1>

<?php
$con=mysqli_connect("localhost","tt2^homas12","c3o7P1518","tt2^homas12");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}

$result = mysqli_query($con,"SELECT * FROM caller_info");

echo "<table border='1'>
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Franchise</th>
</tr>";

while($row = mysqli_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['Firstname'] . "</td>";
echo "<td>" . $row['Lastname'] . "</td>";
echo "<td>" . $row['Franchise'] . "</td>";
echo "</tr>";
}
echo "</table>";

mysqli_close($con);
?> 

</body>
</html> 

<h1>Insert a New Caller</h1>
<form action="insert.php" method="post">
Firstname: <input type="text" name="firstname">
Lastname: <input type="text" name="lastname">
Franchise: <input type="text" name="franchise">
<input type="submit" name="submit">
</form>

</body>
</html>

<html>
<body>

<h1>Delete a Caller</h1>
<form action="delete.php" method="post">
Lastname: <input type="text" name="lastname">
<input type="submit" name="submit">
</form>

</body>
</html>

特许经营呼叫记录
插入新呼叫者
名字:
姓氏:
特许经销权:
删除呼叫者
姓氏:


记录已更新

在delete.php上,您不是从
$\u POST

if(isset($_POST['lastname'])){
$Lastname=$_POST['lastname'];

}else{
echo "Error";die();
}
$sql= ("DELETE FROM caller_info WHERE Lastname = '$Lastname'");

了解并使用or-将帮助您决定使用哪一种。如果您选择PDO


从未设置$Lastname变量。
if(isset($_POST['lastname'])){
$Lastname=$_POST['lastname'];

}else{
echo "Error";die();
}
$sql= ("DELETE FROM caller_info WHERE Lastname = '$Lastname'");