sending an email at the same time as setting the form action to another page

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • djsjm
    New Member
    • Nov 2008
    • 23

    sending an email at the same time as setting the form action to another page

    Hi there,

    Beg of your forgiveness if this is too basic or the question has already been answered somewhere... I'm still learning my way around php and this site.

    I have a form on page 1 which is sent to be displayed on page 2. Is there a way to do this while also sending an email to me with the information that was submitted? I know how to do both individually, just not simultaneously, and google isn't helping (wait, why am I still googling now that I found bytes?)

    Thanks in advance... you guys are the best.

    ~ Deb
  • Markus
    Recognized Expert Expert
    • Jun 2007
    • 6092

    #2
    Just do it on page 2 with the information coming from page one.

    Comment

    • djsjm
      New Member
      • Nov 2008
      • 23

      #3
      Yes, I thought about that as well. The reason I'd like to do it this way is this:

      On page 1 they enter contact information.
      On page 2 they enter payment information (there's a reason for separating them).

      If, for some reason, they don't complete the payment information on page 2, I'd like to have their contact information so that I can email them to follow up and answer any questions they may have.

      So, that takes us back to the original question. Is it possible?

      Thanks bunches, if I was there I'd give you a cupcake with chocolate sprinkles.

      Comment

      • Atli
        Recognized Expert Expert
        • Nov 2006
        • 5062

        #4
        The second page can email you the data from the first page whether or not they actually submit the form on the second page.

        The logic being:
        Code:
        ## Page 1
        <form action="page2" method="post">
          <input type="text" name="contactData" />
        </form>
        
        ## Page 2
        <?php
        mail ("to@example.com" , "Contact data" , $_POST['contactData']);
        ?>
        <form action="page3" method="post">
          <input type="text" name="paymentData" />
        </form>
        
        ## Page 3
        <?php
          // This is where you would process the payment data.
        ?>
        This is obviously not a working example, but you get the point?

        Comment

        • djsjm
          New Member
          • Nov 2008
          • 23

          #5
          OMG you are just awesome.

          Yes, I got it to work with one of the entries... but there are 6 entries... how do I get all six of them? I've experimented a bit with no luck.

          Comment

          • djsjm
            New Member
            • Nov 2008
            • 23

            #6
            I figured it out! All I usually need is someone to point me in the right direction. =)

            Thanks bunches!

            ~ Deb

            Comment

            • Atli
              Recognized Expert Expert
              • Nov 2006
              • 5062

              #7
              Glad you got it working :)

              Comment

              Working...