Problème de passage de variables
Salut à tous !
Je dois créer un site qui trie des données portant sur des revues scientifiques.
Dans un premier temps, on a une liste de catégories de revues et on doit pouvoir en sélectionner plusieurs pour afficher les revues appartenant à ces catégories sur une autre page.
J'ai donc créé deux procédures "formCatégorie" et "formRevue" qui affichent des tableaux avec les données, et, pour chaque ligne, une checkbox. Pour passer d'une procédure à l'autre, j'utilise une méthode GET.
Le code se compile nickel.
Quand je coche une seule catégorie, ça marche très bien mais quand j'en sélectionne plusieurs, il ne m'affiche que la première que j'ai cochée :?
Par contre, l'URL contient bien les catégories que j'ai cochées :
http://ntelline.cict.fr:7780/ETUPRE/...=6&cat=7&cat=8
(J'utilise la variable "cat" pour les checkbox)
J'ai essayé plusieurs méthodes mais aucune n'a rien donné.
J'ai appris qu'on pouvait utiliser une fonction "split" pour décomposer ma variable "cat" :?
Je vous passe mon code :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
| create procedure formCategorie is
id_cat number;
begin
htp.headOpen;
htp.headClose;
htp.htmlOpen;
htp.bodyOpen;
htp.formopen(curl => 'http://ntelline.cict.fr:7780/ETUPRE/b3bd3.formRevue', cmethod => 'get');
htp.tableOpen(cborder => 'BORDER="1"',cattributes => 'WIDTH="100%"');
htp.tableCaption('Categories','CENTER');
for ligne in (select * from categorie) LOOP
htp.tableRowOpen;
htp.tabledata('<INPUT TYPE="checkbox" NAME="cat" value="' || ligne.id_cat || '">');
htp.tableData(ligne.id_cat);
htp.tableData(ligne.nom);
htp.tableRowClose;
end loop;
htp.tableClose;
htp.bodyClose;
htp.htmlClose;
htp.formSubmit(cvalue=>'Valider');
end;
create procedure formRevue (cat in number) is
begin
htp.headOpen;
htp.headClose;
htp.htmlOpen;
htp.bodyOpen;
htp.tableOpen('BORDER');
htp.tableCaption('Liste des revues','CENTER');
htp.tableRowOpen;
htp.tableHeader ('');
htp.tableHeader ('Nom_court');
htp.tableHeader ('Nom_long');
htp.tableHeader ('Nom');
htp.tableHeader ('Intitule');
htp.tableHeader ('Date_extraction');
htp.tableHeader ('Score');
htp.tableHeader ('Nb_article');
htp.tableRowClose;
htp.print( cat );
for ligne in (select nom_court,nom_long,nom,intitule,date_extraction,score,nb_article
from revue,categorie,domaine,extraction,possession
where possession.id_cat= categorie.id_cat
and categorie.id_domaine= domaine.id_domaine
and revue.issn=extraction.issn
and possession.issn = revue.issn
and cat=categorie.id_cat
order by nom_long)loop
htp.tableRowOpen;
htp.tableData('<INPUT TYPE="checkbox" NAME ="blabla" >');
htp.tableData(ligne.nom_court);
htp.tableData(ligne.nom_long);
htp.tableData(ligne.nom);
htp.tableData(ligne.intitule);
htp.tableData(ligne.date_extraction);
htp.tableData(ligne.score);
htp.tableData(ligne.nb_article);
htp.tableRowClose;
end loop;
htp.formopen(curl => 'http://ntelline.cict.fr:7780/ETUPRE/b3bd3.formTrie', cmethod => 'get');
htp.print('<label for="trie"> Classe par : </label>');
htp.print ('<select name="trie" id="trie">
<option value="nom_long"> nom_long </option>
<option value="nom_court"> nom_court </option>
<option value="score"> score </option>
<option value="nb_article"> nb_article </option></select>');
htp.formSubmit(cvalue=>'Valider');
htp.tableClose;
htp.bodyClose;
htp.htmlClose;
end; |
J'aimerais aussi savoir si il est possible de que le fait de cocher une checkbox serve de condition pour un if ?
par exemple :
if (la_checkbox_est_cochée) then
....;
end if;
Merci d'avance ! :lol: