<div id="cuerpoprincipal">
         <h2><?php 
htmlout($titulopagina);
?>
</h2>
         <?php 
$formulario = array('parametro' => array('label' => 'Parametro', 'tipo' => 'select2', 'option' => $parametros), 'metodo' => array('label' => 'Metodo', 'tipo' => 'text'));
?>
          <form id="acredform" name="acredform"  action="" method="post">
            <?php 
foreach ($formulario as $key => $value) {
    ?>
            <div>
              <?php 
    $value['atts'] = array('style' => 'width:250px');
    crearForma(isset($value['label']) ? $value['label'] : '', $key, isset($valores[$key]) ? $valores[$key] : '', isset($value['atts']) ? $value['atts'] : '', $value['tipo'], isset($value['option']) ? $value['option'] : '');
    ?>
            </div>
            <br>
            <?php 
}
?>
      	  <div>
            <?php 
if (isset($id)) {
    ?>
              <input type="hidden" name="id" value="<?php 
    htmlout($id);
    ?>
">
            <?php 
    <br>
    <br>
    <?php 
foreach ($formulario as $key => $value) {
    ?>
      <?php 
    if (!isset($value['atts']['style'])) {
        $value['atts'] = array('style' => 'width:250px');
    }
    $valor = "";
    if (isset($value['valor'])) {
        $valor = $value['valor'];
    } elseif (isset($valores[$key])) {
        $valor = $valores[$key];
    }
    crearForma(isset($value['label']) ? $value['label'] : '', $key, trim($valor), isset($value['atts']) ? $value['atts'] : '', $value['tipo'], isset($value['option']) ? $value['option'] : '');
    ?>
      <br><br>
    <?php 
}
?>
    <div>
      <?php 
if (isset($id)) {
    ?>
        <input type="hidden" name="id" value="<?php 
    htmlout($id);
    ?>
">
      <?php 
}
              <fieldset>
                <legend><?php 
    echo "Toma " . ($j < $cantidad ? $j + 1 : "Compuesta");
    ?>
:</legend>
                <?php 
    /* Foreach2 */
    foreach ($formulario2 as $key => $value) {
        ?>
                  <?php 
        if (isset($_SESSION['supervisada'])) {
            $value['atts'] = array('disabled');
        }
        ?>
                  <?php 
        crearForma($value['label'], "mcompuestas[" . $j . "][" . $key . "]", $mcompuestas !== "" ? isset($mcompuestas[$j][$key]) ? $mcompuestas[$j][$key] : '' : '', isset($value['atts']) ? $value['atts'] : '', $value['tipo'], isset($value['option']) ? $value['option'] : '');
        ?>
                  <br>
                <?php 
        /* Foreach2 */
    }
    ?>
              </fieldset>
              <br>
            <?php 
}
?>

            <!-- Se usa para almacenar el numero de la ot y saber que se usó el regreso -->
            <?php 
if (isset($regreso) and $regreso === 1) {
            ?>
">
                  <br><br>
                <?php 
        }
    }
    ?>

              <?php 
    $valor = "";
    if (isset($value['valor'])) {
        $valor = $value['valor'];
    } elseif (isset($valores[$key])) {
        $valor = $valores[$key];
    }
    crearForma($value['label'], $key, $valor, isset($value['atts']) ? $value['atts'] : '', $value['tipo'], isset($value['option']) ? $value['option'] : '', isset($value['extra']) ? $value['extra'] : '');
    ?>
              <?php 
    if ($key === "tipodescarga") {
        ?>
                <input type="<?php 
        echo $tipohidden ? 'hidden' : 'text';
        ?>
" id="tipodescargah" value="<?php 
        echo isset($valores['tipodescarga']) ? $valores['tipodescarga'] : '';
        ?>
">
              <?php 
    }
    ?>
            <tr>
              <td><input name="adicionales[<?php 
    echo $i;
    ?>
][resultado]" class="form-control" type="text" style="width:70px;" value="<?php 
    echo isset($valores['adicionales'][$i]['resultado']) ? $valores['adicionales'][$i]['resultado'] : '';
    ?>
"></td>
              <td>
                <?php 
    if (!isset($valores['adicionales'][$i]['parametro'])) {
        $valores['adicionales'][$i]['parametro'] = '';
    }
    ?>
                <?php 
    crearForma('', 'adicionales[' . $i . '][parametro]', $valores['adicionales'][$i]['parametro'], '', 'select', $adicionales);
    ?>

              </td>
            </tr>
          <?php 
}
?>
        </tbody>
      </table>
      <br>

      <div>
        <input type="submit" class="btn btn-success" name="accion" value="Guardar">
      </div>
  </form>
            }
            crearForma("Muestra " . ($i < $cantidad ? $i + 1 : "Compuesta"), "mcompuestas[" . $i . "][" . $key . "]", $compuesta, isset($value['atts']) ? $value['atts'] : '', $value['tipo'], isset($value['option']) ? $value['option'] : '');
            ?>
                                    <br>
                                <?php 
        }
        ?>
                            </fieldset>
                            <br>
                  <?php 
    } else {
        for ($i = 0; $i < $cantidad + 1; $i++) {
            if (isset($_SESSION['supervisada'])) {
                $value['atts'] = array('disabled');
            }
            crearForma('', "mcompuestas[" . $i . "][" . $key . "]", $mcompuestas !== "" ? isset($mcompuestas[$i][$key]) ? $mcompuestas[$i][$key] : '' : '', '', $value['tipo'], '');
        }
    }
}
?>
              <div>
                  <input type="hidden" name="id" value="<?php 
htmlout($id);
?>
">
                  <?php 
if (isset($_SESSION['supervisada'])) {
    ?>
                      <p><a href="../generales">Terminar</a></p>
                  <?php 
} else {