title: How to assign array multiple values with isset input on form submition in php
body: <p>I am trying get a form submitted values in array after <code>isset()</code> but it store only last <code>isset()</code> value in array. What is the right way to get all not null values in array to pass to insert function.</p>
  
  <pre><code>$table = 'booking';
  if(isset($_POST['tourID'])){
      $data = array('tour_fk' =&gt; $this-&gt;input-&gt;post('tourID'));
  }
  if(isset($_POST['bookingNumber'])){
      $data = array('booking_number' =&gt; $this-&gt;input-&gt;post('bookingNumber'));
  }
  $query = $this-&gt;dashboard_model-&gt;insert($table, $data);
  </code></pre>