title: PHP/MySQL - Fail to update form
body: <p>I've been playing a bit with updating a form including checkboxes, which was a bit harder than I expected.</p>
  
  <p>Now that I thought I'd done everything right, it's just not updating. I don't have a clue why at this moment.</p>
  
  <p>This is the page with the form:</p>
  
  <pre><code>&lt;?php 
  
  include "style.css";
  include "connect.php";
  include "header.php";
  
  
  //This code runs if the form has been submitted
  
  $id = htmlspecialchars($_GET["id"]);
  $query  = "SELECT * FROM draaiboek_users WHERE id = '$id'";
  $result = mysql_query($query);
  $data=mysql_fetch_array($result);
  
  ?&gt;
  
  
  &lt;table&gt;
  &lt;p align="right"&gt;&lt;button onclick="history.go(-1);"&gt;Terug&lt;/button&gt;&lt;/p&gt;
  &lt;/table&gt;
  
  &lt;form action="users-update.php" method="post"&gt;
  &lt;input type="hidden" name=ud_id" value="&lt;? echo $id; ?&gt;"&gt;
  
  &lt;table border="0"&gt;
  &lt;br&gt;
  &lt;tr&gt;&lt;td&gt;Gebruikersnaam:&lt;/td&gt;&lt;td&gt;
  
  &lt;input type="text" name="ud_username" maxlength="60" value="&lt;? echo ($data['username']); ?&gt;"&gt;
  
  &lt;/td&gt;&lt;/tr&gt;
  
  &lt;tr&gt;&lt;td&gt;Module Basisgegevens:&lt;/td&gt;&lt;td&gt;
  
  &lt;input type="checkbox" name="ud_mod_basisgegevens" value="1"&lt;?php if($data['mod_basisgegevens'] == '1') echo 'checked'; ?&gt;&gt;
  
  &lt;/td&gt;&lt;/tr&gt;
  
  &lt;tr&gt;&lt;td&gt;Module Personeel:&lt;/td&gt;&lt;td&gt;
  
  &lt;input type="checkbox" name="ud_mod_personeel" value="1"&lt;?php if($data['mod_personeel'] == '1') echo 'checked'; ?&gt;&gt;
  
  &lt;/td&gt;&lt;/tr&gt;
  
  &lt;tr&gt;&lt;td&gt;Module Vrijwilligers:&lt;/td&gt;&lt;td&gt;
  
  &lt;input type="checkbox" name="ud_mod_vrijwilligers" value="1"&lt;?php if($data['mod_vrijwilligers'] == '1') echo 'checked'; ?&gt;&gt;
  
  &lt;/td&gt;&lt;/tr&gt;
  
  &lt;tr&gt;&lt;td&gt;Module Gasten:&lt;/td&gt;&lt;td&gt;
  
  &lt;input type="checkbox" name="ud_mod_gasten" value="1"&lt;?php if($data['mod_gasten'] == '1') echo 'checked'; ?&gt;&gt;
  
  &lt;/td&gt;&lt;/tr&gt;
  
  &lt;tr&gt;&lt;td&gt;Module Artistiek:&lt;/td&gt;&lt;td&gt;
  
  &lt;input type="checkbox" name="ud_mod_artistiek" value="1"&lt;?php if($data['mod_artistiek'] == '1') echo 'checked'; ?&gt;&gt;
  
  &lt;/td&gt;&lt;/tr&gt;
  
  &lt;tr&gt;&lt;td&gt;Module Publiekswerking:&lt;/td&gt;&lt;td&gt;
  
  &lt;input type="checkbox" name="ud_mod_publiekswerking" value="1"&lt;?php if($data['mod_publiekswerking'] == '1') echo 'checked'; ?&gt;&gt;
  
  &lt;/td&gt;&lt;/tr&gt;
  
  &lt;tr&gt;&lt;td&gt;Module Techniek:&lt;/td&gt;&lt;td&gt;
  
  &lt;input type="checkbox" name="ud_mod_techniek" value="1"&lt;?php if($data['mod_techniek'] == '1') echo 'checked'; ?&gt;&gt;
  
  &lt;/td&gt;&lt;/tr&gt;
  
  &lt;tr&gt;&lt;td&gt;Module Financien:&lt;/td&gt;&lt;td&gt;
  
  &lt;input type="checkbox" name="ud_mod_financien" value="1"&lt;?php if($data['mod_financien'] == '1') echo 'checked'; ?&gt;&gt;
  
  &lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;th colspan=2&gt;&lt;br&gt;&lt;input type="submit" name="submit" 
  value="Update"&gt;&lt;/th&gt;&lt;/tr&gt; &lt;/table&gt;
  
  &lt;/form&gt;
  </code></pre>
  
  <p>And this is the update page:</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;?php
  
  include 'style.css';
  include 'connect.php';
  include 'security.php';
  include 'header.php';
  
  ?&gt;
  &lt;/head&gt;
  
  
  &lt;body&gt;
  
  &lt;table&gt;
  
  &lt;?php 
    $ud_id = $_POST['ud_id'];
    $ud_username = $_POST['ud_username'];
    $ud_mod_basisgegevens = ($_POST['ud_mod_basisgegevens'] == '1') ? "1" : "0";
    $ud_mod_personeel = ($_POST['ud_mod_personeel'] == '1') ? "1" : "0";
    $ud_mod_vrijwilligers = ($_POST['ud_mod_vrijwilligers'] == '1') ? "1" : "0";
    $ud_mod_gasten = ($_POST['ud_mod_gasten'] == '1') ? "1" : "0";
    $ud_mod_artistiek = ($_POST['ud_mod_artistiek'] == '1') ? "1" : "0";
    $ud_mod_publiekswerking = ($_POST['ud_mod_publiekswerking'] == '1') ? "1" : "0";
    $ud_mod_techniek = ($_POST['ud_mod_techniek'] == '1') ? "1" : "0";
    $ud_mod_financien = ($_POST['ud_mod_financien'] == '1') ? "1" : "0";
  
  
    $query = "UPDATE draaiboek_users SET username = '$ud_username' mod_basisgegevens = '$ud_mod_basisgegevens' mod_personeel = '$ud_mod_personeel' mod_vrijwilligers = '$ud_mod_vrijwilligers' mod_gasten = '$ud_mod_gasten' mod_artistiek = '$ud_mod_artistiek' mod_publiekswerking = '$ud_mod_publiekswerking' mod_techniek = '$ud_mod_techniek' mod_financien = '$ud_mod_financien' WHERE id = '$ud_id'";
  
    mysql_query($query);
    echo "Record updated";
    mysql_close();
  ?&gt;
  
  &lt;/table&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Any ideas how this comes?</p>
  
  <p>Thanks,<br>
  Daan</p>