0

I've looked around and tried a few things but can't get this to work or find an answer.

I hold my forms on a website in an iframe as they need to ping an email via php to parse into our database. Problem is is the thank you message is just an html message within that frame.

I need when someone hits the submit button that the user is redirected to another main page. Not just in the iframe.

This is the end of the php:

// send email
$success = mail($email_to, $email_subject, $Body, "From: <$email_from>");

// redirect to success page
if ($success){
  print "<meta http-equiv=\"refresh\" content=\"0;URL=contact-sent-asc.html\">";

}
else{
  print "<meta http-equiv=\"refresh\" content=\"0;URL=URL=error.html\">";
}
?>

Instead of it going to URL=contact-sent-asc.html (which is in the iframe) I need it to redirect the main page and not the iframe.

Hope that makes sense. Any help would be appreciated!

Thanks, Iain

  • Does this answer your question? [Redirect parent window from an iframe action](https://stackoverflow.com/questions/580669/redirect-parent-window-from-an-iframe-action) – Nijeesh Joshy Feb 05 '20 at 10:29
  • Redirect main frame if iframe has thank you page? – nice_dev Feb 05 '20 at 10:41
  • @NijeeshJoshy Unfortunately I can't get it to work. In the php above where would I put the window.top.location.href = "http://www.example.com"; that everyone is saying should work? I'm obviously doing something wrong but can't figure it out :( – theiainternet Feb 05 '20 at 23:35

0 Answers0