我想检测php是否满足条件,如果不显示javascript警报框并阻止表单处理
我试图设置警报框,但它始终运行
function confirmfillin()
{
$pm = $SQL->query("SELECT * FROM `".TABLE_PREFIX."shopping` WHERE user_id='".$userdata['id']."' AND shopping_id='".$store['id']."'");
if (mysql_num_rows($pm)<1) {
echo "<script type='text/javascript'>alert('fill in form');</script>";
}
}
?>
<form action=postfinish.php method=POST>
<input name="title" type="text" value="my title" >
<div style="position:fixed; bottom:4in; right:20;"><input type="submit" class="submitter" onClick=<?php confirmfillin(); ?> value="Select your item and submit" style="width:220px;"></div>
</form>
页面每次加载时都会显示警报