Solved

Re-direct users after email script

Posted on 2008-10-01
6
215 Views
Last Modified: 2012-05-05
I have a PHP mail script (see below) that is working great.  However, at this time, when someone hits SEND on the HTML page, it just directs them to a blank white page, so they keep hitting back & send again.

What would it take in this PHP script to re-direct it to thankyou.html once they have submitted the form?

Thanks!
<?php

 

// Report PHP errors

error_reporting(E_ALL);

 

// Assign the variables

$requester = $_POST['requester'];

$phone = $_POST['phone'];

//$date = date(F j, Y);

$bdesc = $_POST['bdesc'];

$desc = $_POST['desc'];

$loc = $_POST['loc'];

$cdate = $_POST['cdate'];

$dept = $_POST['dept'];

$email = $_POST['email'];

 

// Mail

$static = "rusty.page@bioness.com";

$subject = $bdesc;

$body = "<strong>"."Requester's Name:     " ."</strong>". $requester . "<br>" . "<strong>". "Requester's Phone Number:     " ."</strong>". $phone . "<br>" ."<strong>"."Problem Description:     " ."</strong>". $desc . "<br>" . "<strong>"."Location:     " ."</strong>".$loc . "<br>" ."<strong>"."Date needed by:     "."</strong>" . $cdate . "<br>" ."<strong>". "Requester's Department:     " ."</strong>". $dept;

$headers = 

      "From: " . $email . "\r\n" . 

      "Reply-To: " . $email . "\r\n" . 

      "MIME-Version: 1.0" . "\r\n" . 

      "Content-type: text/html;charset=iso-8859-1" . "\r\n" .

      "X-Mailer: PHP/" . phpversion();

mail($static, $subject, $body, $headers);
 

 

?>

Open in new window

0
Comment
Question by:rustyrpage
  • 4
  • 2
6 Comments
 
LVL 14

Accepted Solution

by:
EMB01 earned 500 total points
Comment Utility
All you should need to do is add this to your script:
header("Location: http://www.example.com/"); /* Redirect browser */
/* Make sure that code below does not get executed when we redirect. */
exit;
0
 
LVL 6

Author Comment

by:rustyrpage
Comment Utility
Do I put that at the very end of the script? (after the mail line)
0
 
LVL 14

Expert Comment

by:EMB01
Comment Utility
Note: Just add it to the end of the script.
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 14

Expert Comment

by:EMB01
Comment Utility
Yeah, let me know if you need any more help.
0
 
LVL 6

Author Comment

by:rustyrpage
Comment Utility
Pure genius!

Thanks again - you were so much help!
0
 
LVL 14

Expert Comment

by:EMB01
Comment Utility
Hey, it's you putting it all together! By the way, let me know if you want to add validation. It's a little more tricky but we can do it. Have a great afternoon!
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Both Easy and Powerful How easy is PHP? http://lmgtfy.com?q=how+easy+is+php (http://lmgtfy.com?q=how+easy+is+php)  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now