0

我的代码有一点问题,我不知道我的代码有什么问题......所以我有两种形式,第一个加载是“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>

谢谢。!

4

2 回答 2

1

just as a guess, just from your code:

correct the flaw, then change

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

to

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

and

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

to

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

and all references to this as well, since "form" is a reserved word in IE and this.form.action may lead to errors there.

于 2013-06-23T12:38:41.773 回答
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元素:)

于 2013-06-23T12:44:15.173 回答