title: Translate HTML form request to php array
body: <p>I have a html form with 3 selector:</p>
  
  <pre><code>a. Room -&gt; 1, 2, 3, 4, 5, 6
  b. Adults -&gt; 1, 2, 3, 4, 5, 6
  c. Childs -&gt; 0, 1, 2, 3, 4, 5
  </code></pre>
  
  <p>THe php arrays that i need to get looks like:
  Example 1 room with 2 adults</p>
  
  <pre><code>$rooms[] = array(array("paxType" =&gt; "Adult"), array("paxType" =&gt; "Adult")); 
  </code></pre>
  
  <p>Example 2 rooms ( one room is with two adults and the second room si with 2 adults an 
  one child</p>
  
  <pre><code>$rooms[] = array(array("paxType" =&gt; "Adult"), array("paxType" =&gt; "Adult"));
  $rooms[] = array(array("paxType" =&gt; "Adult"), array("paxType" =&gt; "Adult"), array("paxType" =&gt;"Child", "age" =&gt; 8)); 
  </code></pre>
  
  <p>The variables that i receive from the form are as below:</p>
  
  <pre><code>$City= $_POST['City']; - text
  $CheckIN= $_POST['CheckIN']; - text (date)
  $CheckOUT= $_POST['CheckOUT']; - text (date)
  $Rooms= $_POST['Rooms']; - selector (1,2,3,4,5,6)
  $Adults= $_POST['Adults']; - selector (1,2,3,4,5,6)
  $Childs= $_POST['Childs']; - selector (0,1,2,3,4,5) 
  </code></pre>
  
  <p>Form is workink fine for text and date input fields.
  How can i translate the html form request to get into the a bove look like php arrays.
  Thank you for your time.</p>
  
  <p>Entire code is:</p>
  
  <pre><code>// create SOAP client object
    $client = new SoapClient("http://www.bookingassist.ro/test/book.wsdl", array('trace' =&gt; 1));
  
    try {
        function addPaxType($type = null, $amount = 0)
  {
      $pax = array();
      for ($i = 0; $i &lt; amount; $i++)
      {
         array_push($pax, array('paxType' =&gt; $type));
      }
      return $pax;
  }  
  
  $RoomsLength = 1;//count($_POST['Rooms']);
  $Rooms = array();
  
  //iterate over all rooms
  for ($i = 0; $i &lt; $RoomsLength ; $i++)
  {
      $Rooms[$i] = array();
  
      if ( count($Adults) &gt; 0)
      {
          //use a function to add adults to room
          array_push($Rooms[$i] , addPaxType('Adults', count($Adults)));
      }
      if (count($Childs) &gt; 0)
      {
          array_push($Rooms[$i], addPaxType('Childs', count($Childs)));
      }
  } 
  
        $filters = array();
        $filters[] = array("filterType" =&gt; "hotelStar", "filterValue" =&gt; "3", "4", "5");
  
        $filters[] = array("filterType" =&gt; "resultLimit", "filterValue" =&gt; "7");
  
        // make getAvailableHotel request (start search)
        $checkAvailability = $client-&gt;getAvailableHotel("gfdgdfgVNhTzA4MVZ3Y2hjTkt3QXNHSXZRYUZOb095Qg==", "RHMK", "2015-03-30", "2015-04-12", "EUR", "RO", "false", $rooms, $filters);
    }
    catch (SoapFault $exception) {
        echo $exception-&gt;getMessage();
        exit;
    }
  </code></pre>