I need form data to be sent to two different pages(a0.php & a1.php)
. I cant use session because I dont have access to (a1.php)
page.
So now i want some intermediate page where i can access the form data and redirect to another page as form post itself.
existing
//front end
<form action="a1.php" method="post">
</form>
//a1.php
<?php
var_dump($_POST);
?>
Needed
//front end
<form action="a0.php" method="post">
</form>
//a0.php
<?php
var_dump($_POST); //access form data here
header("location:a1.php")// pass form post data through redirection
?>
//a1.php
<?php
var_dump($_POST); //access form data here also in same format/fashion
?>
Note: I dont want to pass parameters in url, in this case, I prefer POST
over GET
You can use javascript.
onClick
will fire function that will send the data to first page without refreshing (ajax), and so send to the second page.It seems that in the days of jQuery, Angular Js and Ajax, people are forgetting about plain Javascript. Around 2005, I had submitted a php page to itself and to another php page in another Frame. Here is my code:
JS
It still works perfectly. KISS principle says "Keep it simple, stupid!"
Please try the following:
On a0.php page
On a1.php
Here you can use ajax.
When you will click submit button, then using jquery you can get the values and post to a page using ajax.
Then the first form will be submitted after the ajax call.
I hope it will help.
Thanks
You can include a1.php inside a0.php so that all post variables are available in a1.php too
include('a1.php');