title: Handling a form and its action: one page or two?
body: <p>When doing web programming there seem to be two different ways of handling a form and its action. Is there a reason to prefer one method over the other?</p>
  
  <p><b>Method 1:</b>  One page that displays a form or handles a submitted form. This seems simple, in that there's one form for everything. But it also means the if/else cases can become rather large.</p>
  
  <pre><code>if [form has not been submitted] {
      // display form for user input
  } else {
      // handle submitted form
  }
  </code></pre>
  
  <p><b>Method 2:</b> Handle user input on one page with a form, with the form submitting to a second page.</p>
  
  <p>page 1 (input.html): </p>
  
  <pre><code>&lt;form action="./submit.html"&gt;
      // display form for user input
  &lt;/form&gt;
  </code></pre>
  
  <p>page 2 (submit.html): Handles the input from the form.</p>
  
  <p>I've seen both of these methods used. The upside of the first method is that there's only one page and one set of variables to worry about, but the page can get large. In the second method, each file is simpler and shorter, but now you have twice as many files to worry about and maintain.</p>