Connecting Tech Pros Worldwide Help | Site Map

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

djsjm's Avatar
Newbie
 
Join Date: Nov 2008
Location: USA
Posts: 23
#1: Nov 3 '08
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's Avatar
Moderator
 
Join Date: Jun 2007
Location: York, England, with wolves.
Posts: 4,936
#2: Nov 3 '08

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


Just do it on page 2 with the information coming from page one.
djsjm's Avatar
Newbie
 
Join Date: Nov 2008
Location: USA
Posts: 23
#3: Nov 3 '08

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


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.
Atli's Avatar
Moderator
 
Join Date: Nov 2006
Location: Iceland
Posts: 3,745
#4: Nov 3 '08

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


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:
Expand|Select|Wrap|Line Numbers
  1. ## Page 1
  2. <form action="page2" method="post">
  3.   <input type="text" name="contactData" />
  4. </form>
  5.  
  6. ## Page 2
  7. <?php
  8. mail ("to@example.com" , "Contact data" , $_POST['contactData']);
  9. ?>
  10. <form action="page3" method="post">
  11.   <input type="text" name="paymentData" />
  12. </form>
  13.  
  14. ## Page 3
  15. <?php
  16.   // This is where you would process the payment data.
  17. ?>
  18.  
This is obviously not a working example, but you get the point?
djsjm's Avatar
Newbie
 
Join Date: Nov 2008
Location: USA
Posts: 23
#5: Nov 3 '08

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


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.
djsjm's Avatar
Newbie
 
Join Date: Nov 2008
Location: USA
Posts: 23
#6: Nov 3 '08

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


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

Thanks bunches!

~ Deb
Atli's Avatar
Moderator
 
Join Date: Nov 2006
Location: Iceland
Posts: 3,745
#7: Nov 3 '08

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


Glad you got it working :)
Reply