title: Confirming form after form has been submitted and validated in Symfony
body: <p>I have a appointment form once it has been submitted you get a confirmation of the data you've filled in, The confirmation has a button that when pressed on it it should insert the data to the database.</p>
  
  <p>My question is, how to implement the button on the confirmation so it inserts?</p>
  
  <hr>
  
  <p>I was thinking of making a if statement as this:</p>
  
  <pre><code>if ($form-&gt;isSubmitted() &amp;&amp; $form-&gt;isValid()) {
  
  }
  </code></pre>
  
  <hr>
  
  <p>And within that if statement another if statement that would check if the button on the confirmation had been submitted so i could use the entitymanager to insert it in the database.</p>
  
  <pre><code>if ($form-&gt;isSubmitted() &amp;&amp; $form-&gt;isValid()) {
  
    if () {
          $entityManager = $this-&gt;getDoctrine()-&gt;getManager();
          $entityManager-&gt;persist($appointment);
          $entityManager-&gt;persist($customer);
          $entityManager-&gt;flush();
    }
  
  }
  </code></pre>
  
  <hr>
  
  <p>The appointment form:
  <a href="https://i.stack.imgur.com/HmgOa.png" rel="nofollow noreferrer">The appointment form</a></p>
  
  <p>The confirmation template:
  <a href="https://i.stack.imgur.com/umGwE.png" rel="nofollow noreferrer">The confirmation template</a></p>
  
  <hr>
  
  <p>The appointment form:</p>
  
  <pre><code>{% block body %}
  
      &lt;p&gt;new appointment&lt;/p&gt;
  
      {{ form_start(form) }}
      {{ form_widget(form) }}
      &lt;button class="btn"&gt;{{ button_label|default('Plan In') }}&lt;/button&gt;
      {{ form_end(form) }}
  
  {% endblock %}
  </code></pre>
  
  <p>The confirmation template</p>
  
  <pre><code>{% block body %}
  
      &lt;p&gt;confirm appointment&lt;/p&gt;
  
      &lt;p&gt;{{ customer_name }}&lt;/p&gt;
      &lt;p&gt;{{ customer_phone }}&lt;/p&gt;
      &lt;p&gt;{{ customer_email }}&lt;/p&gt;
      &lt;hr&gt;
      &lt;p&gt;{{ barber_name }}&lt;/p&gt;
      &lt;p&gt;{{ treatment_name }}&lt;/p&gt;
      &lt;p&gt;{{ appointment_date|date('d-m-Y') }}&lt;/p&gt;
      &lt;p&gt;{{ appointment_time|date('H:i') }}&lt;/p&gt;
  
      &lt;button class="btn"&gt;{{ button_label|default('Confirm') }}&lt;/button&gt;
  
  {% endblock %}
  </code></pre>
  
  <hr>
  
  <p>If there is any confusion within my question please ask for clarification, And if you believe there is a better way of achieving what I want to achieve please suggest so.</p>
  
  <p>Any help is appreciated, Thanks in advance.</p>