<?php
session_start();
define('Admin_USER',true);

require_once("../../php/defines.php");
require_once("../../php/classes/mainClass.php");
require_once("../../php/classes/galleryClass.php");

$g = new galleryClass;
$albums = $g->getAlbums($_POST['AlbumCategoryId']);

$display = '';
if($albums[0]['Nbr'] != '' && $_POST['AlbumCategoryId'] != ''){

  $display .= '<select  class="col-md-12" id="Album" name="Album">';
  $display .= '<option value="" selected="selected">- choose -</option>';
  for($i=0;$i<count($albums);$i++){

    $display .= '<option value="'.$albums[$i]['Nbr'].'" ';
    if($_POST['AlbumId'] == $albums[$i]['Nbr']){

      $display .= 'selected="selected"';

    }
    $display .= '>'.$albums[$i]['Name'].'</option>';

  }
  $display .= '</select>';
}else{  

   $display .= '<p>Please select a photo gallery category to get list of albums to associate with this product.</p>';

}

echo $display;
exit;

?>