title: How to pre-populate a web form with data from a database
body: <p>I have a form (actually its 4 different forms on 4 consecutive pages, but to the same effect) which users fill in to sign up to a website. There are many (100+) items in the form, including text boxes, ranges, but mostly checkboxes. </p>
  
  <p>Once the user has signed up I want them to be able to edit their preferences via a simple 'edit' link on their custom homepage. My idea is that they will simply be shown the sign-up forms again, but this time they will be pre-populated using the data linked to their user account from my database.</p>
  
  <p>Is this as simple as the 'edit' link in question containing a POST value to pass to the form pages:</p>
  
  <pre><code>http://www.mysite.com/something.php?edit=true
  </code></pre>
  
  <p>And then checking for this value in the php on the form page, and setting the values in each  form item if edit is <code>true</code>?</p>
  
  <p>The reason im double-checking on this is because it seems an awful lot of code to go through each item in the form and set its value to whatever is in the database and I dont want to do it just to find out later down the line there is a quicker and less programming intensive way of doing this!</p>
  
  <p>In case it helps to find an alternative solution, Im using PDO, the user is identified by way of a session variable containing their (unique) email address, and the form names are identical to the database column names. </p>