<?php
include '../../conexion/session.php';
include '../../conexion/conn.php';
$folio_planilla = $_REQUEST['folio_planilla'];
$folio_pallet = $_REQUEST['folio_pallet'];

$rs = mysql_query("SELECT * FROM contenedor_estiba WHERE folio_planilla='$folio_planilla' AND folio_pallet='$folio_pallet'");

if ($row = mysql_fetch_array($rs)) {
    $num_termo = $row['num_termo'];
}
?>

<select class="form-control" id="num_termo" name="num_termo">
    <?php
    $rs = mysql_query("SELECT termografo_1, termografo_2 FROM contenedor_planilla WHERE folio_planilla = '$folio_planilla'");
    if ($row = mysql_fetch_array($rs)) {
        if ($num_termo == $row['termografo_1']) {
    ?>
            <option value="">Seleccione si hay ...</option>
            <option value="<?php echo $row['termografo_1']; ?>" selected>Termografo 1 - <?php echo $row['termografo_1']; ?></option>
            <option value="<?php echo $row['termografo_2']; ?>">Termografo 2 - <?php echo $row['termografo_2']; ?></option>
        <?php
        } else if ($num_termo == $row['termografo_2']) {
        ?>
            <option value="">Seleccione si hay ...</option>
            <option value="<?php echo $row['termografo_1']; ?>">Termografo 1 - <?php echo $row['termografo_1']; ?></option>
            <option value="<?php echo $row['termografo_2']; ?>" selected>Termografo 2 - <?php echo $row['termografo_2']; ?></option>
        <?php
        } else {
        ?>
            <option value="" selected>Seleccione si hay ...</option>
            <option value="<?php echo $row['termografo_1']; ?>">Termografo 1 - <?php echo $row['termografo_1']; ?></option>
            <option value="<?php echo $row['termografo_2']; ?>">Termografo 2 - <?php echo $row['termografo_2']; ?></option>
    <?php
        }
    }
    ?>
</select>