Reputation: 299
Is there possible to redict multiple page after submit button? For example, user click 'Submit' then it will go to page1.php (same tab) and page2.php (another tab).
<form role="form" method="post" action="">
<button type="submit" name="submit" >Submit</button>
</form>
if(isset($_POST['submit'])){
header("location:page1.php");
header("location:page2.php");
}
Upvotes: 0
Views: 42
Reputation: 689
You can use a combination of php and javascript.
Add a javascript function to the onsubmit of the form:
var win = window.open(url, '_blank');
then, in your php, use your code to check for $_POST var and use:
header('Location: url');
Upvotes: 0
Reputation: 5289
The simple answer is no. Only the page that submitted the request can receive a redirect response. The more complicated answer is if the first page opened the second page it can exercise some control over it via javascript. You could also use a websocket based mechanism to cause a page to reload similar to how react dev server works.
Upvotes: 1