Mysql query not inserting data into database
<p>I'm trying to create a website that connects to a database. My Select statements work to dispay the data, but neither my insert nor my delete statements actually change the data. I've searched around google and stackoverflow, and attempted to try various "answers" when I got stumped, but it's still not working. As a result, the currect state of my code is a hodgepodge of probably redundant code. I'm fairly new to html and php in general, so I would appreciate the help. I also apologize if my formatting is wrong, as I've never used anything like stackoverflow before. Here is a version of the webpage, for those who won't to see the issue in action. EDIT: Fixed. Everyone's comments and answers helped, but it turned out that I had an if statement checking to make sure the input was only letters, when the first two variables posted contained numbers. </p>

<p>if(preg_match("/[A-Z | a-z]+/", $_POST['name'])) was the culprit</p>

<pre><code>&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
&lt;link rel = "stylesheet" type = "text/css" href = "style.css" /&gt;
&lt;/head&gt;
&lt;body&gt;
    &lt;div&gt;
    &lt;form method="post" action="DBADELETE.php?go" id="deleteform"&gt;
       &lt;input name="GMOVIE" type="text" placeholder="GMOVIEID of a movie to    delete" required=""&gt;
    &lt;input name="UMOVIE" type="text" placeholder="UMOVIEID of a movie to delete" required=""&gt;
        &lt;input  type="submit" name="submit" value="DELETE"&gt;            
        &lt;/form&gt;
    &lt;/div&gt;
&lt;div&gt;
    &lt;form method="post" action="DBAUPDATE.php?go" id="updateform"&gt;
       &lt;input name="GMOVIE" type="text" placeholder="GMOVIEID of a movie to update" required=""&gt;
    &lt;input name="UMOVIE" type="text" placeholder="UMOVIEID of a movie to update" required=""&gt;
&lt;input name="TITLE" type="text" placeholder="TITLE of a movie to update" required=""&gt;
&lt;input name="GENRE" type="text" placeholder="GENRE of a movie to update" required=""&gt;
&lt;input name="RATING" type="text" placeholder="RATING of a movie to update" required=""&gt;
        &lt;input  type="submit" name="submit" value="UPDATE"&gt;            
        &lt;/form&gt;
    &lt;/div&gt;
    &lt;div id = "content1" align = "center"&gt;
    &lt;table id = "MOVIES"&gt;
    &lt;tr&gt;
        &lt;th&gt;GMOVIEID&lt;/th&gt;
        &lt;th&gt;UMOVIEID&lt;/th&gt;
        &lt;th&gt;TITLE&lt;/th&gt;
        &lt;th&gt;GENRE&lt;/th&gt;
        &lt;th&gt;RATING&lt;/th&gt;
    &lt;/tr&gt;
&lt;?php
include 'bd.php';
$conn = new mysqli( $host, $user, $pw, $bd_name); 

if ( $conn-&gt;connect_error ) {
    die( "Connection Failed: " . $conn-&gt;connect_error );
}
if(isset($_POST['submit'])){
$gmovie=$_POST['GMOVIE'];
$umovie=$_POST['UMOVIE'];
$title=$_POST['TITLE'];
$genre=$_POST['GENRE'];
$rating=$_POST['RATING'];
$gmov_safe = mysqli_real_escape_string($gmovie,$conn);
$umov_safe = mysqli_real_escape_string($umov,$conn);
$title_safe = mysqli_real_escape_string($title,$conn);
$genre_safe = mysqli_real_escape_string($genre,$conn);
$rating_safe = mysqli_real_escape_string($rating,$conn);  
$q ="INSERT INTO MOVIE (GMOVIEID, UMOVIEID, TITLE,GENRE, RATING)      VALUES($gmovie,$umovie,'$title_safe','$genre_safe','$rating_safe')"
$conn-&gt;query($q);

if ($conn-&gt;query($q) === TRUE) 
{
echo "New record created successfully";
} 
else 
{
echo "Error: " . $q . "&lt;br&gt;" . $conn-&gt;error;
}
}
?&gt;
&lt;?php
include 'bd.php';
$conn = new mysqli( $host, $user, $pw, $bd_name); 

if ( $conn-&gt;connect_error ) {
    die( "Connection Failed: " . $conn-&gt;connect_error );
}
$q = "SELECT GMOVIEID, UMOVIEID, TITLE, GENRE, RATING FROM MOVIE";
$result = $conn-&gt;query( $q );

$row_count = $result-&gt;num_rows;

while ( $row = $result-&gt;fetch_assoc() ) {
    if ( ( $row_count % 2 ) == 1 ) {
        echo "&lt;tr&gt;";
    } else {
        echo "&lt;tr class=\"alt\"&gt;";
    }

    echo "&lt;td&gt;" . $row[GMOVIEID] . "&lt;/td&gt;" .
        "&lt;td&gt;" . $row[UMOVIEID] . "&lt;/td&gt;" .
        "&lt;td&gt;" . $row[TITLE] . "&lt;/td&gt;" .
        "&lt;td&gt;" . $row[GENRE] . "&lt;/td&gt;" .
        "&lt;td&gt;" . $row[RATING] . "&lt;/td&gt;" .
        "&lt;/tr&gt;" . PHP_EOL;

    $row_count--;
  }
?&gt;
 &lt;/body&gt;
&lt;?php $conn-&gt;close(); ?&gt;
&lt;/html&gt;
</code></pre>