Skip to content Skip to sidebar Skip to footer

How To Redirect Back To Index Page And Display Modal Pop Up As Per Redirecting? Php

i have an index page which asks for input. after submit button is clicked, the input is processed in another .php file (process includes using imagecreatefromjpeg and mysql queries

Solution 1:

You can just pass a ?openModal=1 variable to your index page. In your view file, write a conditional that will show your modal. I don't know how your modal is working but either just make the css appear or run your js script that will toggle it on from there.

in your redirect php file

 header('Location: ' . $uploadForm . '?modal=1');

in your html

<?phpif($_GET['modal'] == 1){ ?>do something to make your modal appear
<?php } ?>

Solution 2:

Quick and dirty answer. Modify your other.php file to do something like this:

header('Location:' . $uploadForm . '?thanks=1');

Then in your index.php, at the bottom, near where the body tag closes, do this:

<?phpif (isset($_GET['thanks']) && 1 == $_GET['thanks']) { ?><scripttype='text/javascript'>alert('Thanks!');
</script><?php } ?></body><!-- end of body -->

You can do whatever kind of fancy Javascript you want inside that script tag.

The idea here is simple: when your index.php is given thanks=1 in the query, it shows the modal pop-up. You engineer your other .php to be the only time you expect thanks=1 to be given.

Post a Comment for "How To Redirect Back To Index Page And Display Modal Pop Up As Per Redirecting? Php"