[php] pourquoi ca marche pas ca
Résolu
antic80
Messages postés
4877
Statut
Contributeur
-
antic80 Messages postés 4877 Statut Contributeur -
antic80 Messages postés 4877 Statut Contributeur -
bonjour
voila pkoi ce code ne marche pas
voila pkoi ce code ne marche pas
print' <td class="indice" width="450px" height="50px">';
if ($NumEssai==1){
<div style="display: block;" id="indice1"><img border="0" src="../../../Image/indice1.jpg"></div>
}
if ($NumEssai==2){
<div style="display: block;" id="indice2"><img border="0" src="../../../Image/indice2.jpg"></div>
}
if ($NumEssai==3){
<div style="display: block;" id="indice3"><img border="0" src="../../../Image/indice3.jpg"></div>
}
print '</td>';
11 réponses
-
Salut,
Maily voulais te dire :
print'<td class="indice" width="450px" height="50px"> if ($NumEssai==1) { print'<div style="display: block;" id="indice1"><img border="0" src="../../../Image/indice1.jpg"></div>'; } if ($NumEssai==2) { print'<div style="display: block;" id="indice2"><img border="0" src="../../../Image/indice2.jpg"></div>'; } if ($NumEssai==3) { print'<div style="display: block;" id="indice3"><img border="0" src="../../../Image/indice3.jpg"></div>'; } </td>';
-
Bonjour!
il faut pas mettre print après chaque if et avant <div>?
-
je comprend pas très bien
meme en faisant ca c pareil
print' <td class="indice" width="450px" height="50px">if ($NumEssai==1){ <div style="display: block;" id="indice1"><img border="0" src="../../../Image/indice1.jpg"></div> } if ($NumEssai==2){ <div style="display: block;" id="indice2"><img border="0" src="../../../Image/indice2.jpg"></div> } if ($NumEssai==3){ <div style="display: block;" id="indice3"><img border="0" src="../../../Image/indice3.jpg"></div> } </td>'; -
ca ne marche pas
en essayant d'afficher ma page je n'ai rien ce qui veux dire qu'il y a une erreur de code dans la page -
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question -
Quand tu fais clic droit / Afficher la source tu as quoi ?
-
j'ai ca
<div style="float: top;"> <table colpadding="0" cellspacing="0" style="height: 70px; width: 100%; background-color: #D4D0C8; border-style: solid; border-width: 1px; border-color: #000000;"> <tr> <td style="width: 50%; height: 70px; border-width: 0px; background-color: #D4D0C8;"> <div align="center"> <a target="_blank" href="https://www.keoconcept.com/"><img src="http://00keoconcept.keogratuit.com/banniere/banniere.png" border="0"></a> </div> </td> <td style="width: 50%; border-width: 0px; background-color: #D4D0C8;"> <div align="center"> <script type="text/javascript"><!-- google_ad_client = "pub-9308770625017089"; google_ad_width = 468; google_ad_height = 60; google_ad_format = "468x60_as"; google_ad_type = "text_image"; google_ad_channel =""; google_color_border = "708898"; google_color_bg = "DCE3E9"; google_color_link = "000000"; google_color_url = "666666"; google_color_text = "333333"; //--></script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script> </div> </td> </tr> <tr style="background-color: #000000; text-align: center; height: 20px;"> <td style="border-width: 0px; background-color: #000000;"> <div align="center"> <a target="_blank" href="http://00keoconcept.keogratuit.com/joomla/component/option,com_simplefaq/task,dis..."><font color="#ffffff" size="2">Comment faire disparaitre cette publicité ?</a></font> </td> <td style="text-align: center; border-width: 0px; background-color: #000000;"><font color="#ffffff" size="2">Hébergé GRATUITEMENT par <a target="_blank" href="http://www.keohosting.net"><font color="#ffffff">http://www.keohosting.net</font></a></font> </td> </tr> </table> </div> <br />
-
Pour simplifier:
<td class="indice" width="450px" height="50px"> <div style="display: block;" id="indice<? echo $NumEssai; ?>"><img border="0" src="../../../Image/indice<? echo $NumEssai; ?>.jpg"></div>
-
merci killian mais je souhaite que quand $NumEssai=3 les 3 images soient affichés
-
Ben je sais pas trop comment est ton code php mais même <td class="indice" ne s'affiche pas !
En plus tu as pas de balise <html> ni <head> ni <title> ni <body> qui sont obligatoires sans parler du doctype des attributs obligatoires (alt sur une image, title sur un lien, ...)
Le mieux c'est de copier coller ton code php ici
-
Ben sinon, le soucis c'est que les if sont compris dans les guillemets qui encadrent le texte.
Les guillemets ne doivent contenir que du texte, et pas de code php.
<td class="indice" width="450px" height="50px"> <? if ($NumEssai==1) { print '<div style="display: block;" id="indice1"><img border="0" src="../../../Image/indice1.jpg"></div>'; } elseif ($NumEssai==2) { print '<div style="display: block;" id="indice2"><img border="0" src="../../../Image/indice2.jpg"></div>'; } elseif ($NumEssai==3) { print '<div style="display: block;" id="indice3"><img border="0" src="../../../Image/indice3.jpg"></div>'; } ?> </td> -
c bon j'ai viré tout les print et echo et ca marche
merci a vous