Question

index.php:

    <form action="update_db.php" method="post">
    <?php
        require_once 'modules/' . $currentModule . '.php';
    ?>      
    </form>  

modules/some_module.php

...
<input type="submit" />
...

update_db.php:

@extract( $_POST );
print_r( $_POST );

After loading index.php i see need form. But during submitting i'm coming to the same page (index.php). Why?


http:/****/admin/

Here is html-code generated: http://dpaste.com/93396/


It's so strange, but form generates 2 times... I removed all part of code and rewrited it. Now everything is fine. Thanks all.

Was it helpful?

Solution

I took a look at your site. Your form action is index.php and that is why you keep seeing the same page after you click submit. If your code above is correct, ensure that you do not have <form> tags in your module containing the submit button.

<form action="index.php" method="post">
<table align="center">

    <tr>
        <td>Логин: </td>
        <td><input type="textfield" name="login" /></td>
    </tr>
    <tr>
        <td>Пароль: </td>
        <td><input type="password" name="password" /></td>
    </tr>

    <tr>
        <td></td>
        <td align="right"><input type="submit" name="submit" value="вход" /></td>
    </tr>
<table>
</form>

OTHER TIPS

you have this:

<form action="index.php" method="post">

not this:

<form action="update_db.php" method="post">

Change it and your form will post to update_db.php

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top