0

I have a simple website, index.php within the code of this page, there are three modals, a 'what we do' and a 'contact' which are triggered by buttons, and work as expected. 'Contact' is a simple contact form, this works in so far as enter your details, and click submit. I used code I found online, form-to-email.php which validates and sends an email to me, so that all works fine.

What I am trying to do is once you click submit, it redirects you back to the index.php and opens the last modal, which is id'd as 'thankModal'. Now getting it to open the index.php is no problem using this command:

header('Location: ../index.php');

And I have tried various ways to get this to work and so far no success. I have spent a couple of days googling various things and so far it eludes me.

I presume it is probably something simple like appending the modal name to the end of the header code? I tried that but am unsure of the exact way to structure that.

j08691
  • 190,436
  • 28
  • 232
  • 252
  • 2
    Welcome, Karl! Please show the attempt you made in a [Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve). With only a textual description of your website, it's really hard to guess what is going on. Also, be sure to output [PHP's errors and warnings](https://stackoverflow.com/questions/1053424/how-do-i-get-php-errors-to-display), and show them in the question, if any. – GolezTrol Mar 02 '19 at 16:53
  • There is an easy way to do if your thankModal is PHP code, just add ?submit=true to the end of your header('Location: ../index.php'); like : header('Location: ../index.php?submit=true'); and at the beggining of your thankModal add this line of code : if (isset($_GET['submit']) && $_GET['submit' === true]) { // Your thakModal code here } However this is not a good solution, because if your user refresh that page, they will see that popup again and again ! – Soheyl Mar 02 '19 at 21:32

0 Answers0