<?php
	require_once ('authorize1.php');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">

<head>
<title>Moreno Travel</title>
<script src="sorttable.js"></script>
    <link href="style.css" rel="stylesheet" type="text/css" />
    <meta http-equiv="content-type"
        content="text/html; charset=utf-8" />



</head>


<?php include 'admin_header.php'; ?>

<h1>Edit Hotel</h1>

<i><font color="#C11B17" size="0.5px">Click <a href="admin_addhotel.php" target="blank">here</a> to add a new hotel.</i></font><br><br>


<?php

$hotel_id=$_GET['hotel_id']; 

function location_dropdown($location_id)
{

	$query = sprintf("SELECT * FROM location ");




	$result = mysql_query($query);


	if (!$result) {

    	$message  = 'Invalid query: ' . mysql_error() . "\n";

    	$message .= 'Whole query: ' . $query;

    	die($message);

	}


echo "<select name='location_id'>";
while ($row = mysql_fetch_assoc($result)) {
	
		echo "\n<option value='" .$row['location_id'] . "'";
		if ($row['location_id']==$location_id) echo " selected "; 
		echo " >" . $row['location_name'] . "</option>" ;

	}	
echo "</select>";
}

require_once('connectvars.php');

	

$dbh = mysql_connect(hostname, username, password)

	or die("Unable to connect to MySQL");

mysql_select_db (dbname, $dbh);


$query = "SELECT * FROM hotel 
WHERE hotel_id = $hotel_id";
$result= mysql_query($query) or die(mysql_error());
$row = mysql_fetch_array ($result) or die(mysql_error());


    echo '<p><strong>Hotel ID: </strong>'.$hotel_id.' - Please edit as required.</p>'; 
       echo '<form method="post" action="admin_edithotelscript.php">';
echo '<input type="hidden" name="hotel_id" value="'. $row['hotel_id'].'">';?>


<?php
	location_dropdown($row['location_id']);
?>


<?echo '<br><br><strong>Rating:</strong><br>'.'&nbsp;'.'<input size="5" type="text" name="hotel_rating" value="'.$row['hotel_rating'].'" /> stars &nbsp;<i><font color="#C11B17" size="0.5px">if unknown, enter "0" (zero), "boutique" for boutique, "tesoros" for Tesoros de Mexico, "treasures" for Treasure of Mexico, "b&b" for Bed & Breakfast</font><br><br>';
echo '<strong>Hotel Name:</strong><br>'.'&nbsp;'.'<input size="100" type="text" name="hotel_name" value="'.$row['hotel_name'].'" /><br><br><br><br>';
echo '<strong>Phone:</strong><br>'.'&nbsp;'.'<input type="text" name="hotel_phone" value="'.$row['hotel_phone'].'" /><i><font color="#C11B17" size="0.5px">ie: +XX (XXX) XXX XXXX</font><br><br>';
echo '<strong>Address:</strong><br>'.'&nbsp;'.'<input size="100" type="text" name="hotel_address" value="'.$row['hotel_address'].'" /><br>';
echo '<strong>City:</strong>'.'&nbsp;'.'<input type="text" name="hotel_city" value="'.$row['hotel_city'].'" />';
echo '<strong>State:</strong>'.'&nbsp;'.'<input type="text" name="hotel_state" value="'.$row['hotel_state'].'" />'." ";
echo '<strong>Country:</strong>'.'&nbsp;'.'<input type="text" name="hotel_country" value="'.$row['hotel_country'].'" /><br><br><br><br>';

echo '<strong>Features:</strong><br>'.'&nbsp;'.'<textarea cols="110" rows="10" name="hotel_features">'.$row['hotel_features'].'</textarea><br><br>';
echo '<strong>Green Hotel (if this hotel is green, describe it):</strong><br>'.'&nbsp;'.'<textarea cols="110" rows="10" name="hotel_green">'.$row['hotel_green'].'</textarea><br><br>';
echo '</ul><strong>Picture:</strong><br><input type="text" size="25" name="hotel_pic" value="'.$row['hotel_pic'].'" /><br>
<i><font color="#C11B17" size="0.5px">Enter the name of the file.  Click <a href="admin_hotelpicturelist.php" target="blank">here</a> to see a list of pictures with filenames.  Click <a href="admin_hoteluploadimage.php" target="blank">here</a> to upload a new picture.
<br><br><img width="182px" height="158px" src="hotelimg/'.$row['hotel_pic'].'"><br><br>';


  echo '<input type="submit" value="Submit">';
	echo '</form>';
  


?>


</ul><br><br><br>
</div>


</div>

</body>

</html>