How to consistently transfer the data from the page with the POST method?

Dear friends, could you tell me the novice.
The task in General such: a form that sends data (such as name and phone) with the POST method, after transferring the data of the visitor flips to the page where it asks you to click a button that sends is to is also a POST method, and here I do not understand how to obtain these data (i.e. name, phone number and the fact that people pressed the button) - tell me at least where to go.
March 19th 20 at 08:35
4 answers
March 19th 20 at 08:37
tell me at least where to go

move in the direction of a competent formulation of the question.

Do you need it?

Is 1.PHP!
<form action="2.php" method=post>
Name: <input type=text name=name><br>
Soap: <input type=text name=email><br>
<input type=submit>

It 2.php!
<form action="3.php" method=post>
You check, and then you never know! You entered here th:
Name: <input type=text name=name value="<?php echo $_POST['name']; ?>"><br>
Soap: <input type=text name=email value="<?php echo $_POST['email']; ?>"><br>
<input type=submit value="I checked tarissi head!">

It already 3.php!!!<br>

<?php echo $_POST['name']; ?><br>
<?php echo $_POST['email']; ?>
Yes thank you, just what we need. But have a few questions - why it is advised that you can only use sessions to do. $_POST - is this third file to be transferred. - Aurelia.Lindgren50 commented on March 19th 20 at 08:40
@Aurelia.Lindgren50, well well,
In 2.php you can start the session, and when receiving the POST data to bring them to the session:


and 3.php to retrieve data already from the session:
echo $_SESSION['name'];
echo $_SESSION['email'];

but what's the point? And why this intermediate page - I don't know, so I can't give the intelligible answer. Usually there's an entry form - it leads directly to the processing page. This is done in different ways:

1) normal POST form, when you submit leads to the processing page. If not filled correctly - page offers to go back and refill the form.
2) the Form without reloading the page with AJAX you send data, where the callback is passed the server's response, and depending on the answer the user is displayed the right info, highlighted errors in the form, or print out any information.

What do you do - for me generally a riddle. Something more specific I guess.

In General, Dunn between the pages of my what to say though using GET parameter, though using POST, although through cookies, though using localStorage. - mattie.Braun65 commented on March 19th 20 at 08:43
Turned out to make only session_start();
$_POST - see works for you - and I for some reason did not. - Aurelia.Lindgren50 commented on March 19th 20 at 08:46
@Aurelia.Lindgren50, well, the word "reason" in programming - does not exist. There is a text error, dumps, logs.

To sampit any object and see its structure, use the function var_dump();

For example, if you from one page to another sent _POST request, and in the end did not get, write on the destination page

the <pre>

and you will see all the data came in the POST. Replace $_POST with $_SESSION and see session data. And you can do this with any object, an array, a variable.

Don't know what you have there does not work, download my files. No idea what's there not to work: - mattie.Braun65 commented on March 19th 20 at 08:49
Yes thanks, I realize of course that "reason" does not happen - but it was important to do at least worked with me and the data was transmitted. (maybe something I missed - that did not work) now your files will look and find where is the error, and will try of course what you recommend. - Aurelia.Lindgren50 commented on March 19th 20 at 08:52
March 19th 20 at 08:39
<?php print_r($_POST); ?>
March 19th 20 at 08:41
look how is implemented
first form is filled
and data processor send.php
where there is a button which is simply pressed and the data you passed to the handler upsell.php - no hidden fields in the example no.
and failure is the common link to the page thanks
I.e. you need to pass in send.php the name and the post method, and then press the button and upsell.php to obtain the name, phone number and the fact of pressing the button too post method? Or the name and bodies in upsell.php unnecessary?) - una commented on March 19th 20 at 08:44
March 19th 20 at 08:43
Use session.
 $_SESSION['number'] = 0123456789;
 $_SESSION['name'] = 'John';

then in the right place to use as a normal array element
 $num = $_SESSION['number'];
 $name = $_SESSIOM['name'];

Find more questions by tags PHP