<?php
include ("check_session.php");

$location_name = addslashes($_POST['location_name']);
$location_name = str_replace("AMPERSAND", "&", $location_name);
$address = addslashes($_POST['address']);
$address2 = addslashes($_POST['address2']);
$city = addslashes($_POST['city']);
$state = $_POST['state'];
$country = $_POST['country'];
if (isset($_POST['postal_code']))
	$postal_code = $_POST['postal_code'];
else
	$postal_code = "";
if (isset($_POST['location_categories']))
	$location_categories = $_POST['location_categories'];
else
	$location_categories = "";	
if (isset($_POST['phone']))
	$phone = $_POST['phone'];
else
	$phone = "";
if (isset($_POST['website']))
	$website = $_POST['website'];
else
	$website = "";
if (isset($_POST['web_link_text']))
	$web_link_text = $_POST['web_link_text'];
else
	$web_link_text = "";
if (isset($_POST['email']))
	$email = $_POST['email'];
else
	$email = "";
if (isset($_POST['event_owner']))
	$location_owner = $_POST['event_owner'];
else
	$location_owner = "";

$query = "INSERT INTO `" . BWB_TABLE_PREFIX . "locations` SET `location_name` = :location_name, `address` = :address, `city` = :city, `state` = :state, `country` = :country, `postal_code` = :postal_code, `location_categories` = :location_categories, `phone` = :phone, `website` = :website,
`web_link_text` = :web_link_text, `email` = :email, `location_owner` = :location_owner";

$stmt = $bwb_dbh->prepare($query);

$stmt->execute(array(':location_name' => $location_name, ':address' => $address, ':city' => $city, ':state' => $state, ':country' => $country, ':postal_code' => $postal_code, ':location_categories' => $location_categories, ':phone' => $phone, ':website' => $website, ':web_link_text' => $web_link_text, ':email' => $email, ':location_owner' => $location_owner));

echo $bwb_dbh->lastInsertId();
?>