How do I send a variable value from my form to another page using the POST method? In the first page I have the following code:

$form['message1'] = array(
  '#markup' =&gt; $this-&gt;t('Check Your Details once again !!'),
);

$form['candidate_name'] = array(
  '#type' =&gt; 'textfield',
  '#title' =&gt; t('Candidate Name:'),
  '#required' =&gt; TRUE,
);

$form['Back'] = array(
  '#type' =&gt; 'submit',
  '#value' =&gt; t('Back'),
);


$form['submit']= array(
  '#type' =&gt; 'submit',
  '#value' =&gt; t('Proceed To Pay'),
);

return $form;


function submitForm(array &amp;$form, FormStateInterface $form_state){
  drupal_set_message($this-&gt;t('@candidate_name! Wow! Nice choice! Thanks for telling us!', array('@candidate_name' =&gt; $form_state-&gt;getValue('candidate_name'))));
  $form_state-&gt;setRedirect('second_page');
}


In the second page I have the following code:

public function buildForm(array $form, FormStateInterface $form_state) {

  $form['name'] = array(
    '#type' =&gt; 'textfield',
    '#title' =&gt; t('Candidate Name:'),
    '#required' =&gt; TRUE,
  );

  $form['Back'] = array(
    '#type' =&gt; 'submit',
    '#value' =&gt; t('Back'),
  );

  return $form;
}


How can I get the first page candidate name into the second page candidate textfield?
This is how I send information from one form to another.

In the first page:

use \Drupal\Core\Url;

function submitForm(array &amp;$form, FormStateInterface $form_state){
  drupal_set_message($this-&gt;t('@candidate_name! Wow! Nice choice! Thanks for telling us!', array('@candidate_name' =&gt; $form_state-&gt;getValue('candidate_name'))));

  $params['query'] = [
    'candidate_name' =&gt; $form_state-&gt;getValue('candidate_name'),
  ];

  $form_state-&gt;setRedirectUrl(Url::fromUri('internal:' . 'second_page', $params));
}


In the second page:

public function buildForm(array $form, FormStateInterface $form_state) {   
  $candidate_name = \Drupal::request()-&gt;query-&gt;get('candidate_name');

  $form['name'] = array(
    '#type' =&gt; 'textfield',
    '#title' =&gt; t('Candidate Name:'),
    '#required' =&gt; TRUE,
    '#value' =&gt; $candidate_name,
  );

  return $form;
}


EDIT: For POST method I never see it before, but you can create in the first page a session var and use this var in the second var after the redirection. Take a look in Storing Session Data with Drupal 8.

SECOND EDIT: It seems that the correct way todo this is with PrivateTempStore, if you go to see the CommentAdminOverview in Core you will see this:

  /**
   * {@inheritdoc}
   */
  public function submitForm(array &amp;$form, FormStateInterface $form_state) {
      ...
      $info = [];
      /** @var \Drupal\comment\CommentInterface $comment */
      foreach ($comments as $comment) {
        $langcode = $comment-&gt;language()-&gt;getId();
        $info[$comment-&gt;id()][$langcode] = $langcode;
      }
      $this-&gt;tempStoreFactory
        -&gt;get('comment_multiple_delete_confirm')
        -&gt;set($this-&gt;currentUser()-&gt;id(), $info);
      $form_state-&gt;setRedirect('comment.multiple_delete_confirm');
    }
  }


In this page you collect the comment id that you want to delete and made a redirect, and the comment deletion happens in comment.multiple_delete_confirm (ConfirmDeleteMultiple) that have the following code:

  /**
   * {@inheritdoc}
   */
  public function buildForm(array $form, FormStateInterface $form_state) {
    $this-&gt;commentInfo = $this-&gt;tempStoreFactory-&gt;get('comment_multiple_delete_confirm')-&gt;get($this-&gt;currentUser()-&gt;id());
    if (empty($this-&gt;commentInfo)) {
      return $this-&gt;redirect('comment.admin');
    }
    /** @var \Drupal\comment\CommentInterface[] $comments */
    $comments = $this-&gt;commentStorage-&gt;loadMultiple(array_keys($this-&gt;commentInfo));
  ...
  }


So, we don't have a POST method from one form to another in Drupal 8 but this can be solved in this way.