Click here to Skip to main content
15,889,527 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have a form submission via POST. I submit the form, and all is well, however if I try to reload the new page that the form goes to after submission, I get the "Do you want to resend data" message (FireFox). It might happen in other browsers too, but I'm not sure.

What I have tried:

<?php
if(isset($_POST['submit_ex']))
{
$name = $_POST['nameex'];
$email = $_POST['emailex'];
$mobnum = $_POST['phoneex'];
$typehidden=$_POST['current_url'];
$textmessage =$_POST['messageex'];

$msg = $_POST['msg'];


$to = 'pavan@onemg.co';

// subject
$subject = 'ONEMG Expertise Enquiry';

// message
$message = '


<title>ONEMG Enquiry Details


ONEMG Works Enquiry Details



<!--

-->





<!--



-->





















ONEMG Works Enquiry Details
Name:'.$name.'
Mobile:'.$mobnum.'
Email Id:'.$email.'
Mobile Number:'.$mobnum.'
Current Enquiry Page:'.$typehidden.'
Message:'.$textmessage.'



';

// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

// Additional headers
//$headers .= 'To: Alterego <info@alterego360.in>' . "\r\n";
$headers .= 'From: <'.$email.'>' . "\r\n";


// Mail it
//mail($to, $subject, $message, $headers);
//header("location:portfolio/portfolio.php?page=portfolio");
//header("location:index.php");
//header("location:portfolio.php");
//echo "window.location='http://www.onemindgroup.com/onemg-test/thank-you-expertise.php'";

if(@mail($to, $subject, $message, $headers))
{
echo "window.location='http://www.onemindgroup.com/onemg-test/thank-you-expertise.php'";
}else{
echo "Mail was not sent!";
}
}

?>
Posted
Updated 1-Aug-17 23:37pm

1 solution

The problem is a bit complicated...
You have a form with POST action; the first time you are loading it it has no client side data, so POST will do nothing; any other time (refresh/back and others) it will have client side data, so there should be a POST (according to HTTP), but browser identifies the situation and ask you what to do...
Try this as a solution: Redirect After Post[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900