Same FormMailer for many pages
I need a FormMailer that will handle all my webpages. I want to know from which page they called the Form and have the ThankYou page send them back to that calling page. Is there any php code out there that will do this?
When your form-producing page begins to load you'll need to identify the page that sent the user there. There's a few ways.
When the user visits a page that has a link to the form, have that page's logic include its own URL location in the user's session. This can later be pulled out after the form is processed and the user can be returned to it.
Have the sending page include a URL or an identifier that maps to a URL, as a parameter when calling the form-producing page, ala: form.php?returnURL=http://www.blah.com (with proper URL encoding)
You'd then either store the returnURL value in the session or include it within the form as a hidden field; just some way to keep track of it as the user is filling out and submitting the form.
You can try to capture the referrer URL HTTP variable and similarly store its value in session or a hidden field. Referrer fields can be a bit iffy, though, so I'm not sure I'd trust it.
You process your form and send the email. Depending on what you chose above, you'd either grab the return URL from the session or from $_POST, and redirect the user to it.