title: Best Way to Post Data from Large Forms & Hold Data in Inputs after Errors
body: <p>This is a "best practice"/"most efficient" question. I have a large form (20+ fields). Form post into one large MySQL table.</p>
  
  <p>No I can't break up the form and no, I can't break up the table (its being used to hold measurements); used by admin sales reps. Also, I don't want to use Javascript. </p>
  
  <p>I know I can do this:
  HTML</p>
  
  <pre><code>&lt;form action="etc.php" method="post"&gt;    
  &lt;input type="text" name="neck" value=""&gt;
  &lt;input type="text" name="arm" value=""&gt;
  &lt;input type="text" name="back" value=""&gt;
  &lt;input type="text" name="chest" value=""&gt;
  &lt;input type="text" name="legs" value=""&gt;
  &lt;submit button&gt;
  </code></pre>
  
  <p>PHP</p>
  
  <pre><code>&lt;? 
  $_POST['neck']; 
  $_POST['back']; 
  $_POST['arm']; 
  $_POST['chest']; 
  $_POST['legs']; 
  $postMeasurements = "INSERT INTO measurements (etc, etc, etc,) VALUES (etc, etc, etc) WHERE etc='etc'; query ($postMeasurements);
  ?&gt;
  </code></pre>
  
  <p>But is there a faster way? Instead of having to declare each individual post, simply just run a loop that takes all the data post and inserts into the table. Even if the data has be in the same order of the columns of the table or if the input names have to be the same as the table column names is fine by me; I am just getting tired have to keep writing all these $_POST variables into.</p>
  
  <p>Second question: What is the best way to hold this data in case of an error? As it stands now, I hold everything in $_SESSION (one session variable for each input), then redirect back to the form page if there is an error with an error message. then echo each $_SESSION variables as that inputs value.</p>
  
  <p>Thanks, </p>