Ive been having difficulties trying to load form data into my database. Im trying to input theatre info using the following php script.
<?php
require('connect.php');
if (isset($_POST['theatre_name']) && isset($_POST['website'])){
$theatre_name = $_POST['theatre_name'];
$phone_number = $_POST['phone_number'];
$website = $_POST['website'];
$num_screens = $_POST['num_screens'];
$address = $_POST['address'];
$city = $_POST['city'];
$queryd = "INSERT INTO `Theatres` (theatre_name, phone_number, website,
num_screens, address, city)
VALUES ('$theatre_name', '$phone_number', '$website', '$num_screens',
'$address', '$city')";
$result = mysql_query($queryd);
if($result){
$msg = "Theatre created.";
}
}
?>
The following is my html code:
<!DOCTYPE html>
<html>
<body>
<!-- Form for creating theaters -->
<div class="register-form">
<?php
if(isset($msg) & !empty($msg)){
echo $msg;
}
?>
<form action="theatredb.php" method="POST">
<p><label>Theater Name : </label>
<input type = "text" name= "theatre_name" placeholder= "Theater Name" /></p>
<p><label>Phone Number : </label>
<input type = "text" name= "phone_number" placeholder="Phone Number" /></p>
<p><label>Website : </label>
<input type="text" name= "website" placeholder ="Website" /></p>
<p><label> Number of Screens : </label>
<input type= "text" name="num_screens" placeholder ="Number of screens" /></p>
<p><label>Address : </label>
<input type="text" name="address" placeholder="Address" /></p>
<p><label>City : </label>
<input type="text" name="city" required placeholder="City Name" /></p>
<input class="btn register" type="submit" name="submit" value="done" />
</form>
</div>
</body>
</html>
I was wondering if anyone could give me some guidance with regards to what I'm doing wrong. Ive been stuck with this problem for hours and don't know what I'm doing wrong.
EDIT: I dont get an error per say, but the data does not get uploaded into the database. For some reason my query isnt working.