<?php
//basic include files
require_once("../../db.php");

$choice = $_GET['choice'];

if($choice == 'US') { 
//States
$hotelstate = mysqli_query($conn, "SELECT name, abbrev, country FROM states WHERE country = 'US' ORDER by name ASC");
mysqli_close($conn);
?>

<div class="control-group form-row row-fluid">
  <div class="span12">
    <div class="row-fluid">
      <label class="form-label span3">State</label>
      <div class="span4 controls">
        <select name="hotel_state">
          <option value=''>Select...</option>
          <?php
			while($hotelstateData = mysqli_fetch_array($hotelstate)) { 
				//variables
				$abbrev = $hotelstateData['abbrev'];
				$state = $hotelstateData['name'];
		  ?>
		  <option value="<?php echo $abbrev; ?>"><?php echo $state; ?></option>
		  <?php } mysqli_free_result($hotelstate); ?>
        </select>
      </div>
    </div>
  </div>
</div>

<?php } elseif($choice == 'CA') { 
//States
$hotelstate = mysqli_query($conn, "SELECT name, abbrev, country FROM states WHERE country = 'CA' ORDER by name ASC");
mysqli_close($conn);
?>

<div class="control-group form-row row-fluid">
  <div class="span12">
    <div class="row-fluid">
      <label class="form-label span3">State</label>
      <div class="span4 controls">
        <select name="hotel_state">
          <option value=''>Select...</option>
          <?php
			while($hotelstateData = mysqli_fetch_array($hotelstate)) { 
				//variables
				$abbrev = $hotelstateData['abbrev'];
				$state = $hotelstateData['name'];
		  ?>
		  <option value="<?php echo $abbrev; ?>"><?php echo $state; ?></option>
		  <?php } mysqli_free_result($hotelstate); ?>
        </select>
      </div>
    </div>
  </div>
</div>

<?php } ?>