我在php中有两个页面。第一页是:表单子映射
<?php
// --- please consider that my form is inside a while statement...
<form action='deletepost.php' method='post' >
<input type='hidden' name='var' value='$comment_id;'>
<input type='submit' value='delete' >
</form>
?>
和页面deletepost.php如下:
<?php
$comment = mysql_real_escape_string($_POST['var']);
echo" $comment ";
// --- then starts successfully the delete process I have created...
?>
所以第一页包含表单按钮删除,当我按下它传递,我想页面值deletepost.php成功(我使用echo来查看它,就像你看到的那样)。 我决定在第一页中为我的表单使用JavaScript Lightbox。我已经改变了我的代码是:
<?php
<a href = javascript:void(0) onclick = document.getElementById('light').style.display='block';document.getElementById('fade').style.display='block'><h2><font color=green size=3>Delete All</font></h2></a>
<div id=light class=white_content>
<form action='deletepost.php' method='post' >
<input type='hidden' name='var' value='$comment_id'>
<input type='submit' value='delete' onClick=submit(); >
</form>
<a href=javascript:void(0) onclick=document.getElementById('light').style.display='none';document.getElementById('fade').style.display='none'><button style='margin-left:250px; width:95px;'>Cancel</button></a>
</div>
<div id=fade class=black_overlay></div>
的问题是使用JavaScript后,值不会传递到deletepost.php。任何想法,为什么这可能happend?
从这一行删除onclick事件 – Kishorevarma
我还没有做任何事 – user2491321
关闭第一个<?php标记与?>在下一行并使用如下> – Kishorevarma