<?php 
	require_once('../Connections/pandora.php');
	
	$colname_Recordset1 = "";
	if (isset($_GET['idMarca'])) {
	  $colname_Recordset1 = $_GET['idMarca'];
	}
	$Segme_Recordset1 = "";
	if (isset($_GET['segmento'])) {
	  $Segme_Recordset1 = $_GET['segmento'];
	}
	$query_Recordset1 = sprintf("SELECT id_marcavehiculo, modelo FROM vehiculo LEFT JOIN segmento ON vehiculo.id_segmento = segmento.id  WHERE id_marcavehiculo = '%s' AND segmento = %s GROUP BY id_marcavehiculo,modelo", $colname_Recordset1,'\'' . $Segme_Recordset1. '\'');

	$Recordset1 = mysqli_query($catalogo, $query_Recordset1) or die(mysqli_error());
	$row_Recordset1 = $Recordset1->fetch_assoc();
	$totalRows_Recordset1 = $Recordset1->num_rows;
	
	include("idioma.php");



?>
<?php
	//Si no eligió Marca o no eligió Segmento
	if ($colname_Recordset1 == "0" || $Segme_Recordset1 == "0"){ ?>
		<select name="modelo" id="modelo" class="combo_buscar" style="float:left" disabled="disabled">
			<option value="0"> <?php echo $diccionario['modelo']; ?> </option>
		</select>
	<?php
	}
	else{
	?>
		<select name="modelo" id="modelo" class="combo_buscar" style="float:left">
			<option value="0"> <?php echo $diccionario['modelo']; ?> </option>
		<?php
			do {  
		?>
			<option value="<?php echo $row_Recordset1['modelo']?>">
				<?php echo $row_Recordset1['modelo']?>
			</option>
		<?php
			} while ($row_Recordset1 = $Recordset1->fetch_assoc());
			  $rows = $Recordset1->num_rows;
			  if($rows > 0) {
				  mysqli_data_seek($Recordset1, 0);
				  $row_Recordset1 = $Recordset1->fetch_assoc();
			  }
		?>
		</select>
<?php
	}
mysqli_free_result($Recordset1);
?>
