Good day, im done looking around for an answer to my problem, which is the next one: i have created a function in postgreSQL which is not my main problem, the thing here is that i have an app using PHP that querys over 2 select input and returns a table.
But i need to be able to choose which one of the selected rows is going to be used in the function.
$("#consultaLista").click(function(){
$.ajax({
url:'consulta2.php',
type:'POST',
data:{
cod_a:$("#cod_a").val(),
grupo:$("#grupo").val()
},
success: function(response){
$("#consultalista1").html(response)
}});
});
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Selección</title>
<!--Añadir estilos-->
<link rel="stylesheet" href="../../css/bootstrap4/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="../../css/propios.css">
<!--Añadire scripts-->
<script src="../../thirdparties/jquery/jquery-3.2.1.min.js"></script>
<script src="../../thirdparties/leaflet/leaflet.js"></script>
</head>
<body>
<div class="container">
<h1>Selección de estudiantes</h1>
</div>
<div class="container">
<div class="form-group">
<label for="cod-a"> Seleccione Asignatura
<select name="cod_a" id="cod_a">
<option value="1001">Cálculo 1</option>
<option value="1002">Cálculo 2</option>
<option value="1003">Diseño de Bases de Datos</option>
<option value="1004">Ingeniería de Software</option>
<option value="2001">Termodinámica</option>
<option value="2002">Resistencia de Materiales</option>
<option value="2003">Neumática</option>
<option value="2005">Procesos Industriales</option>
<option value="3001">Circuitos Lógicos</option>
<option value="3002">Digitales</option>
<option value="4001">Cartografía</option>
<option value="2002">Sistemas de Información Geografica</option>
</select>
</label>
</div>
<div class="form-group">
<label for="grupo"> Seleccione Asignatura
<select name="grupo" id="grupo">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
</select>
</label>
</div>
<button type="submit" name="consultalista" id="consultaLista" class="btn btn-primary">Consultar</button>
<hr>
<div id="consultalista1">
</div>
</div>
</body>
</html>
here is my php, sorry i wasnt able to insert it as a code (first question here):
setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $sql=$db->prepare("SELECT cod_e, nom_e, dir, cod_a, n1, n2, n3, ST_AsGeoJSON(ST_Transform(the_geom,4326),5) AS geom FROM asignaturas a NATURAL JOIN inscribe i NATURAL JOIN estudiantes e NATURAL JOIN domicilios d WHERE cod_a= :cod_a AND grupo = :grupo AND e.dir=d.interior"); $params=["cod_a"=>$cod_a,"grupo"=>$grupo]; $sql->execute($params); echo ""; while ($row =$sql->fetch(PDO::FETCH_ASSOC)){ echo ""; foreach ($row AS $field=>$value){ echo "{$value}"; } echo ""; } echo""; ?>the think is that i need to be able to select from that query (i think that with a checkbox) which rows im going to use in my postgreSQL function.
Thanks
Aucun commentaire:
Enregistrer un commentaire