<?php 
	require_once('../Connections/pandora.php');
	
	$colname_Recordset_buscar_segmento = "";

	if (isset($_GET['idMarca'])) {
	  $colname_Recordset_buscar_segmento = $_GET['idMarca'];
	}
	$query_Recordset_buscar_segmento = sprintf("SELECT id_marcavehiculo, segmento FROM vehiculo LEFT JOIN segmento ON vehiculo.id_segmento = segmento.id  WHERE id_marcavehiculo = '%s' GROUP BY segmento, id_marcavehiculo", $colname_Recordset_buscar_segmento);
	$Recordset_buscar_segmento = mysqli_query($catalogo, $query_Recordset_buscar_segmento) or die(mysqli_error());
	$row_Recordset_buscar_segmento = $Recordset_buscar_segmento->fetch_assoc();
	$totalRows_Recordset_buscar_segmento = $Recordset_buscar_segmento->num_rows;
	

	include("idioma.php");
?>
<?php
	if ($colname_Recordset_buscar_segmento == "0"){ 
?>
		<select name="segmento" id="segmento" class="combo_buscar" disabled="disabled">
			<option value="0"> <?php echo $diccionario['segmento']; ?> </option>
		</select>
<?php
	}
	else{
?>
		<select name="segmento" id="segmento" class="combo_buscar" onchange="javascript:Enviar('fragmento_buscar_modelo.php?idMarca=<?php echo $_GET['idMarca']?>&segmento=' + getSeleccionCombo(this), 'Muestra_Modelo', '')">
			<option value="0"> <?php echo $diccionario['segmento']; ?> </option>
		<?php
		do {  
		?>
			<option value="<?php echo $row_Recordset_buscar_segmento['segmento']?>">
				<?php echo $row_Recordset_buscar_segmento['segmento']?>
			</option>
		<?php
		} while ($row_Recordset_buscar_segmento = $Recordset_buscar_segmento->fetch_assoc());
		$rows = $Recordset_buscar_segmento->num_rows;
		if($rows > 0) {
		  mysqli_data_seek($Recordset_buscar_segmento, 0);
		  $row_Recordset_buscar_segmento = $Recordset_buscar_segmento->fetch_assoc();
		}
		?>
		</select>
<?php
	}
mysqli_free_result($Recordset_buscar_segmento);
?>

