Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Re-direct users after email script

Posted on 2008-10-01
6
Medium Priority
?
244 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 14

Accepted Solution

by:
EMB01 earned 2000 total points
ID: 22617747
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
ID: 22617757
Do I put that at the very end of the script? (after the mail line)
0
 
LVL 14

Expert Comment

by:EMB01
ID: 22617758
Note: Just add it to the end of the script.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 14

Expert Comment

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

Author Comment

by:rustyrpage
ID: 22617786
Pure genius!

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

Expert Comment

by:EMB01
ID: 22617813
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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This article discusses how to create an extensible mechanism for linked drop downs.
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 create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

721 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