Good all the time of day.
There is a.php page, and on it there is a form, which with the action (action) method POST sends data to b.php page for processing. Next comes the condition:

 if (условия == удовлетворяют) { // выполняем действия 1 с переменными $iv1, $iv2, $iv3, $iv4 // выполняем действия 2 header("Location: c.php"); exit; } 

What should I write instead of “perform actions 2” so that the data by the post method would pass variables to the c.php page?

  • Why don't you use a GET request? In this case, it is more suitable. - AseN
  • I gave the variables approximate, really their Pts. a lot, and they are very good. long, not every browser is chewed. the main reason is for one of the pages responsible for security - sergey
  • 3
    . This is for one of the security pages. Maybe [include] [1] will help you? To transfer to the page on the same server the data of the POST, this is somehow mildly non-standard. [1]: php.net/manual/ru/function.include.php - ReinRaus

3 answers 3

Why b.php page? In the sense of why the conditions check on it? We checked the conditions on a.php and, depending on the result, switched to b.php or c.php .

If on the b.php page b.php are expected from the user and depending on them a transition is taking place, then use hidden fields to send the data.

On a foreign resource they write that for this you can use curl or fsockopen (). But if this is necessary, it means that the interaction algorithm is not built correctly.

UPDATE. Use include

 if (условия == удовлетворяют) { // выполняем действия 1 с переменными $iv1, $iv2, $iv3, $iv4 include "c.php"; //В файле c.php работаем с переменными $iv1, $iv2, $iv3, $iv4 } 
  • read about fsockopen (), now I will try - sergey
  • can you explain why b.php page is needed? Where do the conditions from if come from? - Vitalii Maslianok
  • b.php - processes the entered data, and only in 1/1000 cases, when additional processing is needed, it is VERY difficult, you need to throw a few variables on the. in general, if the shurik option worked, I would be happy - sergey
  • one
    Added example with include - Vitalii Maslianok
  • one
    It worked. is brilliant, it’s a pity that I didn’t notice the ReinRaus answer right away) - sergey
 if (условия == удовлетворяют) { // выполняем действия 1 с переменными $iv1, $iv2, $iv3, $iv4 // выполняем действия 2 $ch = curl_init('http://yousite.com/c.php'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, array('iv1' => $iv1, ....)); curl_exec($ch); exit; } 

no other way, but this is nonsense.

  • Fatal error: Call to undefined function curl_init () on line $ ch = curl_init (' yousite.com/c.php' ); by itself I forwarded the site to the right ones, and tried this line separately, without the others - sergey
  • So no way. We do not have cURL library installed on your hosting - Alex Kapustin

Why so difficult? just connect the c.php file - and work it out with the parameters

  • can you give an example? - sergey