Problème pour afficher le résultat de 2 liste déroulantes en php

sand285 Messages postés 6 Date d'inscription mardi 19 avril 2005 Statut Membre Dernière intervention 20 avril 2005 - 19 avril 2005 à 12:06
malalam Messages postés 10839 Date d'inscription lundi 24 février 2003 Statut Membre Dernière intervention 2 mars 2010 - 21 avril 2005 à 09:15
Salut,

J n'arrive pas à obtenir le résultat de mes 2 listes déroulantes.Cad: quand je sélectionne une couleur dans le premier choix et le deuxième choix le résultat doit me dire si c'est vrai ou faux.

merci de bien m'aider Sand
-------------------------------------------------------------------
Code php

<html>


<form action= coul.html method=get>

//creation du tableaux couleur1
<SELECT name="couleur1">


<OPTION value=1>Black_velvet</OPTION>
<OPTION value=2>Harcoal</OPTION>
<OPTION value=3>Ebony</OPTION>
<OPTION value=4>Wilson</OPTION>
<OPTION value=5>Starlite</OPTION>
<OPTION value=6>Albinos</OPTION>
<OPTION value=7>Beige_tower</OPTION>
<OPTION value=8>Champagne</OPTION>
<OPTION value=9>Almond_blossoin</OPTION>
<OPTION value=10>Beige_velvet</OPTION>
<OPTION value=11>Afro_violet</OPTION>
<OPTION value=12>Pastel</OPTION>
<OPTION value=13>Saphir</OPTION>
<OPTION value=14>Saphir_velvet</OPTION>


</SELECT>;



//creation du tableaux couleur2
<SELECT name="couleur2">


<OPTION value=1>Black_velvet</OPTION>
<OPTION value=2>Harcoal</OPTION>
<OPTION value=3>Ebony</OPTION>
<OPTION value=4>Wilson</OPTION>
<OPTION value=5>Starlite</OPTION>
<OPTION value=6>Albinos</OPTION>
<OPTION value=7>Beige_tower</OPTION>
<OPTION value=8>Champagne</OPTION>
<OPTION value=9>Almond_blossoin</OPTION>
<OPTION value=10>Beige_velvet</OPTION>
<OPTION value=11>Afro_violet</OPTION>
<OPTION value=12>Pastel</OPTION>
<OPTION value=13>Saphir</OPTION>
<OPTION value=14>Saphir_velvet</OPTION>


</SELECT>;


</from>

</html>


<?php coul.php


$tab[1][1]= false ;
$tab[1][2]= true;
$tab[1][3]= true;
$tab[1][4]= true;
$tab[1][5]= true;
$tab[1][6]= true;
$tab[1][7]= true;
$tab[1][8]= true;
$tab[1][9]= true;
$tab[1][10]= true;
$tab[1][11]= true;
$tab[1][12]= true;
$tab[1][13]= true;
$tab[1][14]=false ;



$tab[2][1]= true;
$tab[2][2]= true;
$tab[2][3]= true;
$tab[2][4]= true;
$tab[2][5]= true;
$tab[2][6]= true;
$tab[2][7]= true;
$tab[2][8]= true;
$tab[2][9]= true;
$tab[2][10]= true;
$tab[2][11]= true;
$tab[2][12]= true;
$tab[2][13]= true;
$tab[2][14]= true;



$tab[3][1]= true;
$tab[3][2]= true;
$tab[3][3]= false;
$tab[3][4]= true;
$tab[3][5]= true;
$tab[3][6]= true;
$tab[3][7]= true;
$tab[3][8]= true;
$tab[3][9]= true;
$tab[3][10]= true;
$tab[3][11]= true;
$tab[3][12]= true;
$tab[3][13]= true;
$tab[3][14]= true;



$tab[4][1]= true;
$tab[4][2]= true;
$tab[4][3]= true;
$tab[4][4]= false;
$tab[4][5]= false;
$tab[4][6]= true;
$tab[4][7]= true;
$tab[4][8]= true;
$tab[4][9]= true;
$tab[4][10]= true;
$tab[4][11]= true;
$tab[4][12]= true;
$tab[4][13]= true;
$tab[4][14]= true;




$tab[5][1]= true;
$tab[5][2]= true;
$tab[5][3]= true;
$tab[5][4]= false;
$tab[5][5]= true;
$tab[5][6]= true;
$tab[5][7]= true;
$tab[5][8]= true;
$tab[5][9]= true;
$tab[5][10]= true;
$tab[5][11]= true;
$tab[5][12]= true;
$tab[5][13]= true;
$tab[5][14]= true;




$tab[6][1]= true;
$tab[6][2]= true;
$tab[6][3]= false;
$tab[6][4]= true;
$tab[6][5]= true;
$tab[6][6]= true;
$tab[6][7]= true;
$tab[6][8]= true;
$tab[6][9]= true;
$tab[6][10]= true;
$tab[6][11]= true;
$tab[6][12]= true;
$tab[6][13]= true;
$tab[6][14]= true;


$tab[7][1]= true;
$tab[7][2]= true;
$tab[7][3]= false;
$tab[7][4]= true;
$tab[7][5]= true;
$tab[7][6]= true;
$tab[7][7]= true;
$tab[7][8]= true;
$tab[7][9]= true;
$tab[7][10]= true;
$tab[7][11]= true;
$tab[7][12]= true;
$tab[7][13]= true;
$tab[7][14]= true;



$tab[8][1]= true;
$tab[8][2]= true;
$tab[8][3]= false;
$tab[8][4]= true;
$tab[8][5]= true;
$tab[8][6]= true;
$tab[8][7]= true;
$tab[8][8]= true;
$tab[8][9]= true;
$tab[8][10]= true;
$tab[8][11]= true;
$tab[8][12]= true;
$tab[8][13]= true;
$tab[8][14]= true;




$tab[9][1]= true;
$tab[9][2]= true;
$tab[9][3]= false;
$tab[9][4]= true;
$tab[9][5]= true;
$tab[9][6]= true;
$tab[9][7]= true;
$tab[9][8]= true;
$tab[9][9]= true;
$tab[9][10]= true;
$tab[9][11]= true;
$tab[9][12]= true;
$tab[9][13]= true;
$tab[9][14]= true;



$tab[10][1]= false;
$tab[10][2]= true;
$tab[10][3]= true;
$tab[10][4]= true;
$tab[10][5]= true;
$tab[10][6]= true;
$tab[10][7]= true;
$tab[10][8]= true;
$tab[10][9]= true;
$tab[10][10]= false;
$tab[10][11]= true;
$tab[10][12]= true;
$tab[10][13]= true;
$tab[10][14]= false;



$tab[11][1]= true;
$tab[11][2]= true;
$tab[11][3]= true;
$tab[11][4]= true;
$tab[11][5]= true;
$tab[11][6]= true;
$tab[11][7]= true;
$tab[11][8]= true;
$tab[11][9]= true;
$tab[11][10]= true;
$tab[11][11]= true;
$tab[11][12]= true;
$tab[11][13]= true;
$tab[11][14]= true;


$tab[12][1]= true;
$tab[12][2]= true;
$tab[12][3]= true;
$tab[12][4]= true;
$tab[12][5]= true;
$tab[12][6]= true;
$tab[12][7]= true;
$tab[12][8]= true;
$tab[12][9]= true;
$tab[12][10]= true;
$tab[12][11]= true;
$tab[12][12]= true;
$tab[12][13]= true;
$tab[12][14]= true;



$tab[13][1]= true;
$tab[13][2]= true;
$tab[13][3]= false;
$tab[13][4]= true;
$tab[13][5]= true;
$tab[13][6]= true;
$tab[13][7]= true;
$tab[13][8]= true;
$tab[13][9]= true;
$tab[13][10]= true;
$tab[13][11]= true;
$tab[13][12]= true;
$tab[13][13]= false;
$tab[13][14]= true;



$tab[14][1]= false;
$tab[14][2]= true;
$tab[14][3]= true;
$tab[14][4]= true;
$tab[14][5]= true;
$tab[14][6]= true;
$tab[14][7]= true;
$tab[14][8]= true;
$tab[14][9]= true;
$tab[14][10]= false;
$tab[14][11]= true;
$tab[14][12]= true;
$tab[14][13]= true;
$tab[14][14]= false;


if ($tab [couleur1][couleur2]) echo " Tr&egrave;s beau ramp;eacute;sultat";

else echo "Ramp;eacute;sultat impossible";


}


?>
-------------------------------------------------------
code html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Document sans nom</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body {
background-color: #CC9999;
margin-left: 0px;
margin-top: 0px;
}
.Style1 {
font-family: Verdana, Arial, Helvetica, sans-serif;
color: #660033;
font-weight: bold;
}
a:link {
color: #663366;
}
a:visited {
color: #CCCCCC;
}
.Style3 {
font-family: Verdana, Arial, Helvetica, sans-serif;
color: #663333;
font-weight: bold;
}
.Style4 {
color: #FFFFFF;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-weight: bold;
}
.Style5 {
font-size: 12px;
color: #666666;
font-style: italic;
font-family: Verdana, Arial, Helvetica, sans-serif;
}
.Style13 {font-size: 14pt}
.Style15 {
font-size: 18px;
font-weight: bold;
color: #333333;
}
-->
</style>
</head>



,

----

&nbsp;,
Bienvenue sur le site consacr&eacute; aux Chinchillas,
<table width="100%" >
----,
News
</td>

----

<marquee id="scroller" scrollamount="1" direction="up" width="100" height="50"
onmouseover="javascript:scroller.stop()" onmouseout="javascript:scroller.start()">
» Voici un script bien utile pour qui veut afficher un panneau de news sur son site !

Vous pouvez bien entendu y insérer du code HTML !

» Par exemple, mettre en gras, italique, souligné, couleur, etc... ou mettre un lien !

</marquee>,

----

<SCRIPT language=javascript>
// Script réalisé par http://www.toutjavascript.com
// Reproduction gratuite à condition de laisser ce commentaire

var ferie=new Array("01/01","01/05","08/05","14/07","15/08","01/11","11/11","25/12");
var mois=new Array("Janvier","F&eacute;vrier","Mars","Avril","Mai","Juin","Juillet","Ao&ucirc;t","Septembre","Octobre","Novembre","D&eacute;cembre");

function disp(txt) { document.write(txt) }
function estFerie(j,m) {
var nb=ferie.length;
var test=false;
for(var i=0;i<nb;i++) {
if ((ferie[i].substring(0,2)==j)&&(ferie[i].substring(3,5)==m)) return true;
}
return false;
}
function calendar(colFond,colTitre,colTexte,colFerie,colOn) {
var d_jour=new Date();
var a=d_jour.getYear(); if (a<1970) {a=1900+a}
var m=d_jour.getMonth()+1;
var d=new Date(a,m-1,1);
var dfin=new Date(a,m-1,1);
var nb_jour=31;
var aff_j="";
for(var k=32;k>27;k--) {
dfin.setMonth(m-1);
dfin.setDate(k);
if (dfin.getMonth()!=m-1) {nb_jour=k-1;}
}

var j1=d.getDay(); if (j1==0) j1=7;
var jour=0;
disp("<CENTER>"+mois[m-1]+" "+a+"</CENTER>");
disp("<TABLE border=0 cellspacing=0 cellpadding='2'>");
disp("----, L</TD>M, M, J, V, S, D, \");
for(var i=0;i<6;i++) {
disp(\"----
\");
for (j=0;j<7;j++) {
jour=7*i+j-j1+2;
aff_j=jour;
if ((jour==d_jour.getDate())&&(m==d_jour.getMonth()+1)) {aff_j=\" \"+jour+\" \";}
if ((7*i+j> =j1-1)&&(jour<=nb_jour)) {
if ((j==6)||(estFerie(jour,m))) disp(\""+aff_j+", \");
else disp(\""+aff_j+", \");
}
else disp(\"&nbsp;, \");
}
disp(\"\");
}
disp("
");
}



</SCRIPT>






<CENTER>
</CENTER>

<center>
<SCRIPT type='text/javascript'>
// Affiche le calendrier
// calendar(colFond,colTitre,colTexte,colFerie,colOn)
calendar("#996666","silver","white","#660066","red");
</SCRIPT>
</td>
</tr>
</table></td>
</tr>
<tr>
<td height="459" colspan="2" bgcolor="#FFFFFF">&lt;Retour au Sommaire&gt;

<CENTER class="Style15">
Il faut choisir deux couleurs
</CENTER>
<form name="monfor" methode="get" action="coul.php">
1er choix

<select name="couleur1">
<option value="1">Black_velvet</option>
<option value="2">Harcoal</option>
<option value="3">Ebony</option>
<option value="4">Wilson</option>
<option value="5">Starlite</option>
<option value="6">Albinos</option>
<option value="7">Beige_tower</option>
<option value="8">Champagne</option>
<option value="9">Almond_blossoin</option>
<option value="10">Beige_velvet</option>
<option value="11">Afro_violet</option>
<option value="12">Pastel</option>
<option value="13">Saphir</option>
<option value="14">Saphir_velvet</option>
</select>
2e choix

<select name="couleur2">
<option value="1">Black_velvet</option>
<option value="2">Harcoal</option>
<option value="3">Ebony</option>
<option value="4">Wilson</option>
<option value="5">Starlite</option>
<option value="6">Albinos</option>
<option value="7">Beige_tower</option>
<option value="8">Champagne</option>
<option value="9">Almond_blossoin</option>
<option value="10">Beige_velvet</option>
<option value="11">Afro_violet</option>
<option value="12">Pastel</option>
<option value="13">Saphir</option>
<option value="14">Saphir_velvet</option>
</select>

</form>

<CENTER>

</center>
&nbsp;

<CENTER>&lt;Retour au Sommaire&gt;

</CENTER>
&nbsp;

&nbsp;

&nbsp;

&nbsp;

&nbsp;

&nbsp;
</td>
</tr>
</table>

</html>

9 réponses

malalam Messages postés 10839 Date d'inscription lundi 24 février 2003 Statut Membre Dernière intervention 2 mars 2010 25
19 avril 2005 à 12:35
Salut,



et...



MON DIEU!!!!



(desole si je jure...)



T'as pas plus long?



Quels sont les criteres pour savoir si c'est vrai ou si c'est faux ?
Parce que la, je refuse de lire ce script pour voir ce qui cloche,
c'est bien trop long.
0
sand285 Messages postés 6 Date d'inscription mardi 19 avril 2005 Statut Membre Dernière intervention 20 avril 2005
19 avril 2005 à 12:41
J'ai 14 tableaux ,quand je choisis 1 couleur dans chaqu'une de mes listes déroulantes il me di d'après mon calul si c'est vrai ou faux

Exemple

$tab[1][1]= false ;
$tab[1][2]= true;
$tab[1][3]= true;
$tab[1][4]= true;
$tab[1][5]= true;
$tab[1][6]= true;
$tab[1][7]= true;
$tab[1][8]= true;
$tab[1][9]= true;
$tab[1][10]= true;
$tab[1][11]= true;
$tab[1][12]= true;
$tab[1][13]= true;
$tab[1][14]=false ;

Sand
0
malalam Messages postés 10839 Date d'inscription lundi 24 février 2003 Statut Membre Dernière intervention 2 mars 2010 25
19 avril 2005 à 12:49
ok, je passe toutes les verifications d'usage avant traitement d'un formulaire...



tu auras un truc du genre :



if ($tab[$_POST['couleur1']][$_POST['couleur2']] == true)

echo 'bravo';

else

echo 'bouh';
0
malalam Messages postés 10839 Date d'inscription lundi 24 février 2003 Statut Membre Dernière intervention 2 mars 2010 25
19 avril 2005 à 12:50
Ps :



je ne peux resister quand meme : ton html est horrible, a reecrire.

Balises en minuscules, fermees, utilise les css au maximum, n'utilise pas de balises depreciees.
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
wodkaist Messages postés 37 Date d'inscription vendredi 28 janvier 2005 Statut Membre Dernière intervention 21 mars 2006
19 avril 2005 à 13:02
Le théorème "tout ce qui est long est bon" a ses exceptions...
0
sand285 Messages postés 6 Date d'inscription mardi 19 avril 2005 Statut Membre Dernière intervention 20 avril 2005
19 avril 2005 à 13:02
Merci beaucoup

Sand
0
sand285 Messages postés 6 Date d'inscription mardi 19 avril 2005 Statut Membre Dernière intervention 20 avril 2005
20 avril 2005 à 22:10
Salut,

J'ai un problème avec mon code ici,quand je fait une selection dans mais liste déroulante il n'affiche pas possible ou pas possible.Et je ne trouve pas mon erreur (j'ai mi tout en post)

merci

<html>


<form action="coul.html" method="post">

//creation du tableaux couleur1
<SELECT name="couleur1">


<OPTION value=1>Black_velvet</OPTION>
<OPTION value=2>Harcoal</OPTION>
<OPTION value=3>Ebony</OPTION>
<OPTION value=4>Wilson</OPTION>
<OPTION value=5>Starlite</OPTION>
<OPTION value=6>Albinos</OPTION>
<OPTION value=7>Beige_tower</OPTION>
<OPTION value=8>Champagne</OPTION>
<OPTION value=9>Almond_blossoin</OPTION>
<OPTION value=10>Beige_velvet</OPTION>
<OPTION value=11>Afro_violet</OPTION>
<OPTION value=12>Pastel</OPTION>
<OPTION value=13>Saphir</OPTION>
<OPTION value=14>Saphir_velvet</OPTION>


</SELECT>;



//creation du tableaux couleur2
<SELECT name="couleur2">


<OPTION value=1>Black_velvet</OPTION>
<OPTION value=2>Harcoal</OPTION>
<OPTION value=3>Ebony</OPTION>
<OPTION value=4>Wilson</OPTION>
<OPTION value=5>Starlite</OPTION>
<OPTION value=6>Albinos</OPTION>
<OPTION value=7>Beige_tower</OPTION>
<OPTION value=8>Champagne</OPTION>
<OPTION value=9>Almond_blossoin</OPTION>
<OPTION value=10>Beige_velvet</OPTION>
<OPTION value=11>Afro_violet</OPTION>
<OPTION value=12>Pastel</OPTION>
<OPTION value=13>Saphir</OPTION>
<OPTION value=14>Saphir_velvet</OPTION>


</SELECT>;


</from>

</html>


<?php coul.php


$tab[1][1]= false ;
$tab[1][2]= true;
$tab[1][3]= true;
$tab[1][4]= true;
$tab[1][5]= true;
$tab[1][6]= true;
$tab[1][7]= true;
$tab[1][8]= true;
$tab[1][9]= true;
$tab[1][10]= true;
$tab[1][11]= true;
$tab[1][12]= true;
$tab[1][13]= true;
$tab[1][14]=false ;



$tab[2][1]= true;
$tab[2][2]= true;
$tab[2][3]= true;
$tab[2][4]= true;
$tab[2][5]= true;
$tab[2][6]= true;
$tab[2][7]= true;
$tab[2][8]= true;
$tab[2][9]= true;
$tab[2][10]= true;
$tab[2][11]= true;
$tab[2][12]= true;
$tab[2][13]= true;
$tab[2][14]= true;

if ($tab[$_POST['couleur1']][$_POST['couleur2']] == true)
echo "Tr&egrave;s beau ramp;eacute;sultat";
else
echo "Ramp;eacute;sultat impossible";





}


?>

sand
0
sand285 Messages postés 6 Date d'inscription mardi 19 avril 2005 Statut Membre Dernière intervention 20 avril 2005
20 avril 2005 à 22:55
suite du message au dessus 20/04 voici mon site en cliquant sur coul rien ce passe et j(ai un base de donnée derrière [javascript:ol('http://membres.lycos.fr/sitechinchilla/'); http://membres.lycos.fr/sitechinchilla/]

Sand
0
malalam Messages postés 10839 Date d'inscription lundi 24 février 2003 Statut Membre Dernière intervention 2 mars 2010 25
21 avril 2005 à 09:15
Ne postes pas 2 fois pour le meme probleme stp.



Tu ne traites pas ton formulaire, tu ne le soumets pas non plus, la. Donc ca ne peut pas fonctionner.
0
Rejoignez-nous