2011-03-23 156 views
0

我使用下面的表格,但是当我按下提交按钮它并不导航到不同的页面提交按钮不工作

<form id="form1" name="form1" method="post" action=""> 
    <table width="100%" border="0" cellspacing="0" cellpadding="0"> 
    <tr> 
     <td colspan="4" align="right"> 
</td> 
    </tr> 
    <tr> 
     <td colspan="4"> 
     <?php display_msg(); ?></td> 
    </tr> 
    <tr> 
     <th width="26%" style="padding-left:5px"><a href="?page=<?php echo $page_number; ?>&amp;<?php echo $name; ?>">Name</a></th> 
     <th width="40%"><a href="?page=<?php echo $page_number; ?>&amp;<?php echo $email; ?>">Email</a></th> 
     <th width="7%">&nbsp;</th> 
<td colspan="5" align="center" bgcolor="#FFFFFF"><input type="submit" name="delete" value="Delete"></td> 
<?php 
// Check if delete button active, start this 
if($delete){ 
echo "<meta http-equiv=\"refresh\" content=\"0;URL=del.php\">"; 
} 
?> 
+0

为什么不将delete.php设置为表单的动作? – Belinda 2011-03-23 15:00:14

回答

2

你应该改变if($delete){if(isset($_POST['delete'])){

-1
<form id="form1" name="form1" method="post" action=""> 

您尚未在表单中定义一项操作。

+4

没有动作的表单将默认为自己。 – 2011-03-23 14:38:17

+0

从这个问题的表达方式来看,我认为这是第一个问题。 – Belinda 2011-03-23 14:59:34