How to do a redirect with the data through header?

The user comes to the page 1.php . I need to redirect it to the page 2.php along with generated in 1.php data.
I tried to write the data in $_POST , but not reach.
In $_GET , but undesirable, as data can be large.
April 7th 20 at 11:03
3 answers
April 7th 20 at 11:09
You yourself know that it is absolutely stupid logic? And what is better to first redirect and then generate?
Yes, logic is perverse. Perhaps the author of a topic wants to insert an intermediate processing form data, not much breaking the architecture of the engine. And maybe - looking for ways to redirect data from another 1.php to your script 2.php.

I've recently discovered that in addition to 301/302 redirect is another redirect with code 307 and 308. They redirects all data sent to guarantee the preservation method and the request body. Maybe the vehicle is necessary... - dane_Bor commented on April 7th 20 at 11:12
@zechariah.Ort, I tried 307 and 308, but post parameters are still not passed. - Jerrell57 commented on April 7th 20 at 11:15
you have NO post data. therefore, nothing is transmitted. - viva_Ryan94 commented on April 7th 20 at 11:18
April 7th 20 at 11:05
Solution
Through session try it!
session_start();
$_SESSION['data'] = $data;
April 7th 20 at 11:07
If the request is received and processed the script 1.php he can do
include('2.php');
and add the script 2 for further processing.

Using the header header('Location: //site.com/2.php?param=val'); you can only pass the GET parameters. But they arrive to the browser, who immediately kicked it back to the server and the script 2.php will have to re-process data from a GET request.
What is the point to drive the user through a redirect, if you simply can immediately process the data the script 2.php or 1.php?

It is not clear what you're trying to do...

Find more questions by tags PHP