Any ideas why this is not actuall writing to the database

<form method="post" action="">
    <p>&nbsp;</p>
    <table width="300" border="0" align="center" cellpadding="0" cellspacing="10">
      <tr>
        <td width="100" align="right">
          Film Title :
        </td>
        <td><input type="text" name="Film_Title"></td>
      </tr>
      <tr>
        <td width="100" align="right">
          Film Format :
        </td>
        <td>
          <select name="Format_ID">
            <option>- Select Film Format -</option>
            <option value="1">DVD</option>
            <option value="2">DVD BoxSet</option>
            <option value="3">UMD</option>
            <option value="4">Bluray</option>
            <option value="5">Bluray BoxSet</option>
            <option value="6">HD DVD</option>
            <option value="7">HD DVD BoxSet</option>
          </select>
        </td>
      </tr>
      <tr>
        <td width="100" align="right">
          Certificate :
        </td>
        <td>
          <select name="Film_Certificate">
            <option>- Certificate -</option>
            <option value="U">U</option>
            <option value="PG">PG</option>
            <option value="12">12</option>
            <option value="15">15</option>
            <option value="18">18</option>
        </select></td>
      </tr>
      <tr>
        <td width="100" align="right">
          Owner :
        </td>
        <td>
          <select name="Film_Owner">
            <option>- Select Owner -</option>
            <option>Blank</option>
            <option value="Shannon">Shannon</option>
            <option value="Annabelle">Annabelle</option>
            <option value="Liam">Liam</option>
            <option value="Leanne">Leanne</option>
            <option value="Ashleigh">Ashleigh</option>
            <option value="Sophie">Sophie</option>
          </select>
        </td>
      </tr>
      <tr>
        <td width="100" align="right">&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td width="100" align="right">&nbsp;</td>
        <td> 
          <button type="submit" name="submit">Add Record</button>
        </td>
      </tr>
  </table>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
</form>

<?php
if(isset($_POST["submit"]))
{

$mysqli = new mysqli("localhost", "u893212501_root", "PASSWORD", "u893212501_magic");

$FilmTitle=$_POST["Film_Title"];
$FormatID=$_POST["Format_ID"];
$Certificate=$_POST["Film_Certificate"];
$Owner=$_POST["Film_Owner"];

$query = mysqli_query($mysqli, "INSERT INTO Films (FilmTitle, FormatID, Certificate, Owner)VALUES ('$FilmTitle', '$FormatID', '$Certificate', '$Owner')");

echo " Added Successfully ";

Hi,

add error checking to the database connection and query execution, if it does not solve, test your query on a MySQL client.

Is this the complete file? It doesn't look like you have a close curly brackets on the If statement that should be st the end of the file.

Additionally, youbshpuld reallllly escape your strings before inserting them into the database so they won't be prone to SQL injection attacks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.