php中的javascript:Document.forms不起作用

php中的javascript:Document.forms不起作用,javascript,php,Javascript,Php,在php中: 在HTML中: if (isset($close_subject)) { $sql_close = "delete from content_tree where user_id='$id' and subject_id='$close_subject'"; $result_close = mysql_query($sql_close); } function xxx() { <a href="#" onClick="closeSubject('<?

在php中:

在HTML中:

if (isset($close_subject)) {
    $sql_close = "delete from content_tree where user_id='$id' and subject_id='$close_subject'";
    $result_close = mysql_query($sql_close);
}

function xxx()
{
<a href="#"  onClick="closeSubject('<? echo $set_subject[subject_id] ?>')"><img border="0" align="absmiddle" src="../../pic/tree/open.png"></a>
}
嗨,我有一些类似上面的代码。我想删除数据库中的记录。但这不是功能><任何人都可以帮助吗

xxx();
<script type="text/javascript">
function closeSubject(id) 
{
    document.close_subject_form.close_subject.value = id;
    document.close_subject_form.submit();
}
</script>


<form name="close_subject_form" method="POST">
    <input type="hidden" id="close_subject" name="close_subject">
</form>

另外,如果,与最佳猜测相反,你知道你在做什么,看看这个狗屎

你能检查一下你的电话转换成了什么吗??我的意思是,尝试检查页面加载后,如果PHP得到正确的评估,标记事件应该看起来像onClick=closeSubject'id',你能确认它是正确的吗?你想实现什么?您说“我想关闭扩展的内容树”,但使用此javascript函数,您将提交表单。“关闭扩展内容”部分在哪里?对不起,我的问题~实际上是我想删除数据库中的记录~。它们不再得到维护。看到了吗?相反,学习,并使用or-将帮助您决定哪一个。如果您选择PDO,。但是我使用的php版本只有5.3.6,并且我可以在没有document.form>的情况下管理数据库。<但是这种情况下,我需要使用document.form>。
function deleteshit($id,$close_subject){
mysql_query("delete from content_tree where user_id='".mysql_real_escape_string($id)."' and    subject_id='".mysql_real_escape_string($close_subject)."'");
return mysql_affected_rows();
}