one form -> two submit buttons -> two destination

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Post Reply
User avatar
Strider64
php-forum Active User
php-forum Active User
Posts: 286
Joined: Sat Mar 23, 2013 8:24 am

Re: one form -> two submit buttons -> two destination

Post by Strider64 » 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" />
</form>
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?

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

Re: one form -> two submit buttons -> two destination

Post by johnj » 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

Who is online

Users browsing this forum: No registered users and 6 guests