Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mail form question. 1

Status
Not open for further replies.

Ivan1

Programmer
Joined
Jun 18, 2001
Messages
113
Location
US
Hello.
I cannot figure out how to redirect my form to another page.
Please check out and click on the on-line quote request on the left hand side. When you press submit button, nothing happens. How do I program my php file to redirect the user to the "thank you for submiting the form" page.
Here is my script so far:

<?
/* subject */
$subject = &quot;QUOTE REQUEST&quot;;

/* additional header pieces for errors, From cc's, bcc's, etc */
$headers = &quot;From: $name <$email>\n&quot;;
$headers .= &quot;X-Sender: <$email>\n&quot;;
$headers .= &quot;X-Mailer: PHP\n&quot;; // mailer
$headers .= &quot;X-Priority: 1\n&quot;; // Urgent message!
$headers .= &quot;Return-Path: $name <$email>\n&quot;; // Return path for errors

/* recipients */
$recipient = &quot;ivan@foundation-one.net&quot;;


/* and now mail it */
mail($recipient, $subject, &quot;Hello Ivan,\nMy name is $name. I'm writing to you on behalf of $company.\nMy phone number is $phone.\nMy e-mail is $email.\nExisting website - $web. The URL is $webaddy.\nBusiness description: $biz\nOn-line marketing goals - $goals\nWe are looking for the following - $needs.\nE-commerce - $ecom.\nProduct gallery - $prodgal.\nNumber of products is $prodnum.\nMy favorite sites are $site and $site1.\nOur budget is $budget.\nMy comments: $comm.\nThis is how we heard about you: $market.\nMy graphic design needs are as follows: $printq.&quot;, $headers);

// Replay
// ---------------------------

/* subject */
$subject = &quot;FOUNDATION ONE DESIGNS,LLC&quot;;

/* additional header pieces for errors, From cc's, bcc's, etc */
$headers = &quot;From: Ivan <ivan@foundation-one.net>\n&quot;;
$headers .= &quot;X-Sender: <ivan@foundation-one.net>\n&quot;;
$headers .= &quot;X-Mailer: PHP\n&quot;; // mailer
$headers .= &quot;X-Priority: 1\n&quot;; // Urgent message!
$headers .= &quot;Return-Path: Foundation One Designs,LLC <ivan@foundation-one.net>\n&quot;; // Return path for errors

/* recipients */
$recipient = $email;

/* message */
$message = &quot;Dear $name,\nThank you for filling out the on-line quote request form. We will review the information you sumbitted within the next two business days, and contact you with an estimate for your project. Thank you for visiting Foundation One Designs and have a great day.\n\nBest regards,\nIvan Annikov\nNew Media Architect\n\nFoundation One Designs, LLC\n\n
mail($recipient, $subject, $message, $headers);
?>



 
Hi,

If all you want to do is redirect the user to a new page after the mail function has been completed, simply put this after the mail function:

echo <META HTTP-EQUIV=\&quot;refresh\&quot; CONTENT=\&quot;0;URL=http://www.site.com/page.html\&quot;>

Hope this helps!

Nate

mainframe.gif

 
Ivan1,

If you want to redirect the visitor within your PHP you should use the header() function.
The <meta> tags are interpreted by the browser once the page is received i.e., the browser will load this first and then redirect to the thank you page.

When you use the header() directive there is no intermediate step with the browser and the redirect is seamless:
Code:
header(&quot;Location: [URL unfurl="true"]http://www.mysite.com/myfile.html&quot;);[/URL]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top