PHP懂的进来

来源:百度知道 编辑:UC知道 时间:2024/06/27 07:11:35
<?php
$id=$_POST['id'];
if($id) {
$hg="delete from lu_yuan where id ='$id'"; //删除数据用的
mysql_query("set names gb2312");
$lwbm=mysql_db_query($biao_ok,$hg,$connect) or die ("Error:".mysql_error());//删除数据用
echo "<script>alert('删除成功');window.location.href='../houtai5.php';</script>";
}
$_pob="select * from lu_yuan order by id desc limit 0,3";
mysql_query("set names gb2312");
$_poc=mysql_db_query($biao_ok,$_pob,$connect);
while($_pod=mysql_fetch_array($_poc)){
echo "<div class=ok1>".$_pod[a]."<br>";
echo $_pod[b]."<br>";
echo "<form method='post' action='' onsubmit='return confirm(' 是否确认提交,你看清楚了吗')'><input name='id' class='ok2' type='hidden' value=".$_pod['id']."/><input

仔细看你的这个语句:
echo "<form method='post' action='' onsubmit='return confirm(' 是否确认提交,你看清楚了吗')'><input name='id' class='ok2' type='hidden' value=".$_pod['id']."/><input type='submit' value='删除' name='del' class='ok3'/></form></div><br /><div style='clear:both'></div>";

你查看输出后的HTML代码(在浏览器查看源文件,其实里面是有语法错误的--引号嵌套重复了,浏览器里面是这样的:
<form method='post' action='' onsumit='return confirm('是否确认提交

建议使用下面的方式:
//特别注意下面一行的END之后不能有任何东西,包括空白
echo <<<END
<form method='post' action=''
onsubmit='return confirm("是否确认提交,你看清楚了吗");'>
<input name='id' class='ok2' type='hidden' value='$_pod[id]'/>
<input type='submit' value='删除' name='del' clas