SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Thread: Combining Forms

  1. #1
    SitePoint Enthusiast
    Join Date
    Mar 2001
    Posts
    80
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I need to submit 3 forms triggered by just one submit button.

    On my humorlab.com site I have a "tell a friend" button on each page. This opens a page where my visitors can enter in their email and that of their friends - then press submit and have an emial sent to each of their friends about that particular page.

    I would like to add 2 checkboxes to my form - one will subscribe the visitor to a netezines.com humor newsletter - the other to subscribe them to my own site news letter.

    How can this be done off a single form???

    thanks

    Mike

  2. #2
    I believe you have my stapler. scrubz's Avatar
    Join Date
    Feb 2001
    Location
    Van down by the river
    Posts
    254
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You shouldn't need three forms to do this. One form should do it. I assume you're using some type of scripting language to handle the form? If so, just check to see if the checkboxes are checked, and include code or another file to handle setting up the newsletter (add user to the database, send them an email, etc.).

  3. #3
    SitePoint Enthusiast
    Join Date
    Mar 2001
    Posts
    80
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I need the 3 parts to go to different target URLs. In my limited experience with forms the target url is normally described in the top
    Code:
    <form>
    tag???

    thanks

    Mike

  4. #4
    I believe you have my stapler. scrubz's Avatar
    Join Date
    Feb 2001
    Location
    Van down by the river
    Posts
    254
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, the page for handling the form is specified by the action of the form...

    <form name="myForm" method="post" action="formHandler.html">

    You could have a regular button on your form that submits all three forms via JavaScript...

    <input type="button" value="Submit" onClick="sendForms();">

    <script language="JavaScript">
    <!--
    function sendForms() {
    formNameOne.submit();
    formNameTwo.submit();
    formNameThree.submit();
    }
    // -->
    </script>

    It would be more efficient though to handle it by one form. And you might have problems submitting all three forms from one page.

  5. #5
    The Hiding One lynlimz's Avatar
    Join Date
    Jul 2000
    Location
    Singapore
    Posts
    2,103
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just a thought...

    Why would you need to submit to three different urls?
    From what I see, you are actually submitting form details, which include checkboxes?

    You can use a script to send it.
    For example, you might want to deliver certain details to this email address, and some other details to another and so on.

    With a script, you can do all this.

    How about letting us know what you are intending to do with the form results. We could actually advise you on better solutions, if yours isn't the best =)


    From what i read in your post, it sounds inefficient to me.
    thanks.
    Just my thought
    "Imagination is more important than knowledge. Knowledge is limited. Imagination encircles the world."
    -- Albert Einstein


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
  •