SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Addict cranjled's Avatar
    Join Date
    Apr 2004
    Location
    ny
    Posts
    382
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Two actions possible out of a single form?

    Is it possible in an HTML form to use two different submit buttons somehow? I know the action is set in the form tag, but I was hoping...

    ...is there maybe a way to have two submit buttons? one that posts to file1.php and another that posts to file2.php ... but all within the same form.

    <fingers="crossed" />

    Thanks,

    Cranjled

  2. #2
    SitePoint Wizard Dylan B's Avatar
    Join Date
    Jul 2004
    Location
    NYC
    Posts
    1,150
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by cranjled
    Is it possible in an HTML form to use two different submit buttons somehow? I know the action is set in the form tag, but I was hoping...

    ...is there maybe a way to have two submit buttons? one that posts to file1.php and another that posts to file2.php ... but all within the same form.
    I don't think so, but what you can do is create two submit buttons with different names, check to see which is set and then redirect do a diferent page with a certain one is clicked with the variables in the url.

  3. #3
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,578
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    You can have file1.php open a connection to file2.php and send the data that was passed to file1.php along, effectively submitting both forms at once.

    http://snoopy.sourceforge.net/ may be helpful

  4. #4
    SitePoint Guru
    Join Date
    Nov 2004
    Location
    Parry Sound, ON
    Posts
    725
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is really a Javascript question.

    On the second submit button do
    onclick="this.form.action='file2.php';"


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •