Hi There,

For some reason I need my form to be submitted twice (in one go).

Is there any way to do that instead of submitting once go back and submit again?

My form based on PHP and Javascript...

Thanks!

mmm... it's little weird but unique

//you can do your action twice but with same parameter like this
<!---------------------- example.php --------------------->
<form id="one" name="one" method="get" action="action.php">
<table>
    <tr>
        <td>Id</td>
        <td>
        <input type="text" name="id" maxlength="30"/>            
        </td>
        </tr>
    <tr>
        <td>Name</td>
        <td>
        <input type="text" name="name" maxlength="30"/>          
        </td>
    </tr>
    <tr>
        <td>
                <input type="submit" value="Save"/>      
        </td>
    </tr>
</table>
</form>



<!------------------------ action.php ----------------------->
<?php
session_start();

$param1 = $_GET['id'];
$param2 = $_GET['name'];

/*................... your submit action ..................

*/

/*if session twice isset, you can do second action to send your parameter with method get */
if(!isset($_SESSION['twice'])){
    $_SESSION['twice'] = 1;
    ?>

    <script type="text/javascript">
        window.location = "<?php echo $_SERVER['PHP_SELF']."?id=".$param1."&name=".$param2; ?>"
    </script>
    <?php
}
else{
    $SESSION['twice'] = 2;
    unset($_SESSION['twice']);
}
?>


// Or if you still want to submit form with button twice, you can use ajax for submit form without refresh
// and you can submit form as many you want without lost your input
// sorry for my word and i'm newbie in php
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.