
EDIT: OOOOOOO, is it this bit?
Code:
<?php
session_start();
if(!$_SESSION['username']) {
//not logged in. redirect to login page
header("Location: hotel-login.php");
exit;
}
$address = "localhost";
$username = "dsf";
$password = "sdf";
$database = "sdf";
mysql_connect($address,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
if (isset($_POST['submit'])) {
$hotel_name = mysql_real_escape_string($_POST['hotel_name']);
$contact = mysql_real_escape_string($_POST['contact_name']);
$telephone = mysql_real_escape_string($_POST['telephone']);
$do = mysql_real_escape_string($_POST['do']);
$have = mysql_real_escape_string($_POST['have']);
$query = "SELECT `hotel_name` FROM `survey` WHERE `hotel_name` = '$hotel_name'";
$result = mysql_query($query);
if (mysql_num_rows($result) == 1) {
$message = 'That hotel name is already in the database. Please use another.';
} else {
mysql_query("INSERT INTO `survey` (hotel_name, contact, telephone, do, have) VALUES
('$hotel_name','$contact','$telephone','$do','$have')");
$message = "Thank you! Your survey is now complete and the information has been submitted";
}
mysql_close();
?>
the { is open, but doesnt seem to close again in the line:
if (isset($_POST['submit'])) {
Double Edit: YES Get in!!!!!!!!
Last edited: