<?php 
include('./config/db.php');

//$idForm=(isset($_GET['idForm']))?$_GET['idForm']:"";

$idForm=(isset($_POST['idForm']))?$_POST['idForm']:"";
$cadena = "";
        try{
        $sqlInstalacion=$conexion->prepare("SELECT inst.id, inst.nombre FROM formularioingreso ing inner JOIN 
        formularioinstalacion ins on ins.formularioId = ing.id inner JOIN instalacion inst on inst.id = ins.instalacionId
        where ing.id in (:id) order by ins.id asc;");  
        $sqlInstalacion->bindParam(":id",$idForm);
        $sqlInstalacion->execute();
        $listaInstalacion = $sqlInstalacion->fetchAll(PDO::FETCH_ASSOC); //almacena todos los registros como arreglo
        foreach($listaInstalacion as $ins) { 
            $cadena = $cadena."<table class='table table-hover'><tbody>";
            $cadena = $cadena."<tr><td><i class='bi bi-arrow-right'>".$ins['nombre']."</i></td><td >";
            $cadena = $cadena."<button type='button' class='btn btn-outline-dark' onclick='eliminarInstalacion(".$idForm.",".$ins['id'].");'>";
            $cadena = $cadena."<i type='submit' class='bi bi-trash' style='font-size: 1rem; color: #BA0700;'></i>";
            $cadena = $cadena."</button></td></tr></tbody></table>";
            } 
            echo $cadena;
        }catch (Exception $err) {
            echo ("Ha ocurrido un error en la solicitud. ");    
            throw $err;
        }
?>