0

Currently my coding does a post command to PHP which pushes the data to an e-mail. I'm looking to find a way to redirect afterward the server has sent the e-mail to a URL.

<?php
$email_from = 'my@e-mail.co.uk';
$email_subject = "New Form submission";
$email_body = "You have received a new insurance enquiry from $firstname $lastname $gender born on $dobday $dobmonth $dobyear $smoker is after $insurtype
They want to cover $cover,000 for $years years for $meandpartner

Contact information:
Mobile: $mobile
Telephone: $landline
E-mail: $email
Street: $street
City: $city
Postcode: $postcode

Partner details:
$pfirstname
$plastname
$pgender
$pdobday $pdobmonth $pdobyear
$psmoker

" ?>

<?php
$to = "my@email.co.uk";
$headers = "From: $email_from \r\n";
$headers .= "Reply-To: my@email.co.uk";
mail($to,$email_subject,$email_body,$headers);
?>
Mike
  • 1

2 Answers2

0

You can use header :

header('Location: mypage.php');

More informations here : http://php.net/manual/en/function.header.php

Thomas Rollet
  • 1,573
  • 4
  • 19
  • 33
  • Thanks, however I get the error: Warning: Cannot modify header information - headers already sent by (output started at /home/quotethemarket/public_html/slider/ionRangeSliderDemo/action_life_insurance.php:40) in /home/quotethemarket/public_html/slider/ionRangeSliderDemo/action_life_insurance.php on line 71 – Mike Apr 14 '17 at 11:51
  • Thanks, I misplaced, now it's working! – Mike Apr 15 '17 at 19:53
0
submitform = name of form

if (isset($_POST['submitform']))
 {?>
  <script type="text/javascript">
   window.location = "http://www.google.com/";
  </script>
<?php }
mayersdesign
  • 5,062
  • 4
  • 35
  • 47
Kahn Kah
  • 1,389
  • 7
  • 24
  • 49