PHP: Not going to the next page

I have a little problem with my code and I don't know what is wrong in my code... So I have a two form where the first load is the "view.php" then the second is "checkbox_building.php".. My problem is when I removed the button of delete in "view.php" the dropdown list can proceed to "checkbox_building.php". but when I placed it back, its not working (its not proceeding to "checkbox_building.php") I'm kinda confuse about this.

Here's my code for "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>

thanks.!

Upvotes: 0

Views: 148

Answers (2)

bystwn22
bystwn22

Reputation: 1794

just remove name='submit' and try

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

so it will be

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

its because this.form.submit is default submit function, but in your code its an input element :)

Upvotes: 1

Axel Amthor
Axel Amthor

Reputation: 11096

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.

Upvotes: 1

Related Questions