帮我看下这2个文件PHP的

来源:百度知道 编辑:UC知道 时间:2024/07/07 03:08:24
<html>
<head>
<title></title>
</head>
<body>
<center>
<?php include("head.html"); ?>
<?php
require_once("config.inc");

$link=mysql_connect($dbhost,$dbuser,$dbpwd) or die('连接失败:'.mysql_error());
mysql_select_db($dbname);

$password=$_POST['fpwd'];
$fid=$_POST['fid'];

$str="select * from finder";
$result=mysql_query($str,$link);
$row=mysql_fetch_row($result);

if($password==$fpwd)
{
$str1="delete from finder where fid='$fid'";
mysql_query($str,$link);
echo "<table width=60% bgcolor=#EEEEEE>";
echo "<tr>";
echo "<td align=center><b>删除成功</b>  <a href='search.php'>|继续查找|  <a href='display.php'>|继续浏览|</a></td>";

不要问了,自己好好想想就明白了

看不明白

echo "<form name=form1 method=POST action=delete.php onsubmit=return CheckValidfpwd();>";
这行的改成这样试试
echo "<form name=form1 method=POST action=delete.php onsubmit='return CheckValidfpwd();'>";
JavaScript也没错,另外不知delete.php的如何?

onsubmit='return CheckValidfpwd();'

就是引号的问题导致不需要密码也能删除

mysql_query($str,$link);
应该改为
mysql_query($str1,$link);
解决没有删掉的问题