PHP:不会进入下一页

时间:2013-06-23 11:21:23

标签: php button

我的代码有点问题,我不知道我的代码有什么问题...所以我有一个两个表单,第一个加载是“view.php”,然后第二个是“checkbox_building”。 php“..我的问题是,当我在”view.php“中删除删除按钮时,下拉列表可以进入”checkbox_building.php“。但当我把它放回去时,它没有工作(它没有进入“checkbox_building.php”)我对此感到困惑。

这是我的“view.php”代码

<fieldset  width= "200px">  
    <form name='form' method='post' action=''>
    Select Network: <select name="netName" onChange="this.form.action='checkbox_building.php'; this.form.submit()">
    <option value="" >- Select -</option>   
    <?php

    include 'connect.php';
    $q = mysql_query("select fldNetname from tblnetwork");

    while ($row1 = mysql_fetch_array($q))
    {
    echo "<option value='".$row1[fldNetname]."'>".$row1[fldNetname]."</option>";
    $net = $row1[fldNetname];

    }
    ?>
    </select>

    <input type='submit' name='submit' value='Delete Building/s' onClick="this.form.action='delete_building.php'; this.form.submit()">
</form>
    </fieldset>

感谢!

2 个答案:

答案 0 :(得分:1)

只是猜测,只需从您的代码中获取:

然后纠正这个缺陷 改变

<input type='submit' name='submit' 

<input type='button' name='dosubmit' 

<form name='form' method='post' action=''>

<form name='<someUsefullName>' method='post' action=''> 

以及对此的所有引用,因为“form”是IE中的保留字,而this.form.action可能会导致错误。

答案 1 :(得分:1)

只需删除name='submit'并尝试

<input type='submit' name='submit' value='Delete Building/s' onClick="this.form.action='delete_building.php'; this.form.submit()">  

所以它将是

<input type='submit' value='Delete Building/s' onClick="this.form.action='delete_building.php'; this.form.submit()">

因为this.form.submit是默认提交功能,但在你的代码中它是一个input元素:)

相关问题