one form -> two submit buttons -> two destination

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
User avatar
php-forum Active User
php-forum Active User
Posts: 315
Joined: Sat Mar 23, 2013 8:24 am
Location: Livonia, MI

Sat Apr 20, 2013 3:46 am

Maybe something like the following will help? I also think it would be better to dump the values of into a database then pull them out at their respective files?

I didn't write the JavaScript for I figure you could figure that out.

Code: Select all

<form action="" id="form" method="post">
    <input type="hidden" name="action1" value="1.php">
    <input type='hidden" name='action2" value="2.php"> 
     <input id="submitButton" type="submit" name="submitBtn" value="Submit" />
Then maybe all you have to do is something like?

Code: Select all

if ($isset($_POST['action1']) && ($isset($_POST['action2'])) {
        if ( $_POST['action1'] == '1.php' ) {
           echo '<a href="test1.php" target="_self">test 1 Form</a>';
           //more code for test1.php data
        if ( $_POST['action2'] == '2.php' ) {
           echo '<a href="test2.php" target="_self">test 2 Form</a>';
          // more code for test2.php data
       /*Like I said I don't now exactly whatca doing? So this might not help */
} // More code?

php-forum Super User
php-forum Super User
Posts: 1803
Joined: Thu Mar 10, 2011 5:07 pm

Sat Apr 20, 2013 4:58 am

save data to session variables or hidden variables and refill the form when you come back.

Post Reply