title: Deleting/Inserting values from PHP codes to microsoft ACCESS?
body: <p>As topic mentioned. How can you insert a record or delete a record using PHP code after connecting to Microsoft Access Database? Thank you!</p>
  
  <p>Edit: I've successfully login with a user account and now i will like to insert records. As below is the code that has not been successful in inserting record.</p>
  
  <pre><code>&lt;?php
  session_start();
  echo "Welcome: ". $_SESSION['role'];
  ?&gt;
  &lt;?php
  error_reporting(0);
  if (!$_POST['submit'])
  {  
  ?
  &lt;html&gt;
  &lt;body&gt;
  &lt;br&gt;&lt;br&gt;
  &lt;fieldset &gt;  
  Add a new user 
  &lt;br&gt;
  &lt;br&gt;
  &lt;label for='username'&gt;Username: &amp;nbsp;&lt;/label&gt;  
  &lt;input type='text' name='username' id='username'/&gt;  
  &lt;label for='password'&gt;Password:&amp;nbsp;&lt;/label&gt;  
  &lt;input type='password' name='password' id='password' maxlength="50" /&gt;  
  &lt;form action="&lt;?=$_SERVER['PHP_SELF']?&gt;" method="post"&gt;
  Role: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
  &lt;br&gt;
  &lt;select name="role"&gt;
  &lt;option value="" selected="selected"&gt;&lt;/option&gt;
  &lt;option VALUE="Administrator"&gt; Administrator&lt;/option&gt;
  &lt;option VALUE="Secretary"&gt; Secretary&lt;/option&gt; 
  &lt;option VALUE="Employee"&gt; Employee&lt;/option&gt;
  &lt;/select&gt;
  &lt;input type='submit' name='Submit' value='Submit' /&gt;  
  &lt;/form&gt;
  &lt;/fieldset&gt;  
  &lt;table width=100%&gt;
  &lt;/html&gt;
  &lt;/body&gt;
  &lt;?php
  }
  else
  {
  $conn=odbc_connect("employee","","") or die (odbc_errormsg());
  if (!$conn)  
  {
  exit
  ("Connection Failed: " . $conn);
  }
  $query = "INSERT INTO empTable (empID, password, Role, Days left in MC, Days left in   leave) VALUES" .
  "('$_POST[username]', '$_POST[password]', '$_POST[role]', 14, 14)";
  $result=odbc_exec($conn,$query) or die ("result error ".odbc_error().'-'.odbc_errormsg());
  odbc_fetch_row($result);
  odbc_close($conn);
  }
  </code></pre>
  
  <p>After clicking the submit button and when i refresh my database, nothing comes out. Why is that so? Thanks alot</p>
  
  <p>Update: Added the POST[username], POST[password], POST[role] and it still does not work :(</p>