title: Form in PDO to update data
body: <p>I've been looking around and even here on the site, but I can not find the correct syntax in PDO to update data, such as the data of a user profile.</p>
  
  <p>You could give me a practical example with html form?
  I know that maybe I ask so much, but I can not make it work.</p>
  
  <p>I enclose what until now have been able to do, but not work.</p>
  
  <pre><code>if(isset($_POST['submit'])) {
      $email      = $_POST['email'];
      $location       = $_POST['location'];
      $id       = $_SESSION['memberID'];
  
      $stmt = $db-&gt;prepare("UPDATE `members` SET `email` = :email, `location` = :location WHERE `memberID` = :id");
  
      $stmt-&gt;bindParam(":email", $email, PDO::PARAM_STR);
      $stmt-&gt;bindParam(":location", $location, PDO::PARAM_STR);
      $stmt-&gt;bindParam(":id", $_SESSION['memberID'], PDO::PARAM_STR);
  
      $stmt-&gt;execute(array(':email' =&gt; $_POST['email'], ':location' =&gt; $_POST['location'], ':id' =&gt; $id));
  }
  </code></pre>
  
  <p>And,</p>
  
  <pre><code>&lt;form role="form" method="POST" action="&lt;?php $_PHP_SELF ?&gt;"&gt;
  &lt;div class="form-group"&gt;
  &lt;label class="control-label"&gt;Email&lt;/label&gt;
  &lt;input type="text" value="&lt;?php echo $_SESSION['email'] ?&gt;" name="email" id="email" class="form-control"/&gt;
  &lt;/div&gt;
  &lt;div class="form-group"&gt;
  &lt;label class="control-label"&gt;Location&lt;/label&gt;
  &lt;input type="text" value="&lt;?php echo $_SESSION['location'] ?&gt;" name="location" id="location" class="form-control"/&gt;
  &lt;/div&gt;
  &lt;div class="margiv-top-10"&gt;
  &lt;input type="submit" name="submit" class="btn green" value="Update" &gt;
  &lt;a href="profile.html" class="btn default"&gt;Annuller &lt;/a&gt;
  &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>I was wondering if it was safe and correct to query the same page or should I create a class? Can you help with a practical example because I have tried everything.</p>