title: What are the options for passing data to PHP?
body: <p>With minimal "real" programming experience, I am working on a project that integrates a FileMaker Pro solution, which I have already built, with a native iOS application using FileMaker Server's PHP API. The iOS application is for iPhone and is written in Swift.</p>
  
  <p>We are trying to understand the most efficient ways to approach some scenarios, particularly in writing data back to the server. Let's use the simple example of an address book. When a user navigates to a contact record, he/she can select a field, edit then save it's contents.</p>
  
  <p>While we have already implemented a number of functions that write data to the server, they have all been relatively simple (like scanning a barcode, sending a php request that triggers a script in FM Server and then presenting the result to the client). It seems like, in the case of a contact record with many fields, that sending the value of each field as a variable, some of which may be paragraphs or photos, through a standard PHP URL inefficient and bulky.</p>
  
  <p>For those unfamiliar with the FileMaker PHP API, below is some sample code to demonstrate the process of updating a specific contact record. The sample code does the following:</p>
  
  <ol>
  <li>Sets parameters passed from the client as variables.</li>
  <li>Defines the layout on which the code should be executed (FM PHP API works on layouts, not tables like SQL)</li>
  <li>Finds a record and updates the fields.</li>
  </ol>
  
  <p>Sample Code:</p>
  
  <pre><code>&lt;?php
  require_once 'Filemaker.php';
  
  //connect to db
  $fm = new FileMaker();
  $fm-&gt;setProperty('database', 'fmDbName');
  $fm-&gt;setProperty('hostspec', '123.45.67.89');
  $fm-&gt;setProperty('username', 'user');
  $fm-&gt;setProperty('password', 'password');
  
  //define layout on which to process
  $layout = 'php_contacts';
  
  //define variables passed from client
  $contactId = $_GET['contactId'];
  $first = $_GET['firstName'];
  $last = $_GET['lastName'];
  $mobile = $_GET['mobile'];
  $office = $_GET['office'];
  $note = $_GET['note'];
  
  //Find the contact which is being updated
  $find = $fm-&gt;newFindCommand($layout);
  $find-&gt;addFindCriterion('contactId', $contactId);
  
  //execute the find
  $results = $find-&gt;execute();
  
  //check for error
  if (FileMaker::isError($result)) {
      echo "     Error: ".$results."     ";
      exit;
  }
  
  //declare the record being updated
  $record = $results-&gt;getFirstRecord();
  
  //update the fields
  $record-&gt;setField('firstName', $first);
  $record-&gt;setField('lastName', $last);
  $record-&gt;setField('mobile', $mobile);
  $record-&gt;setField('office', $office);
  $record-&gt;setField('note', $note);
  
  ?&gt;
  </code></pre>
  
  <p>The challenge we are facing is not <em>how</em> to implement a particular approach, rather, the challenge is understanding what the options are in the first place and any best practices that go along with them.</p>
  
  <p>For example, is sending the variables from the client to PHP as an array or dictionary a better practice than sending them as independent variables in the URL? What are some other options for neatly pushing data from multiple fields in a native application to the PHP server?</p>
  
  <p>Thanks!</p>