[RESOLU] integrer html dans php

Répondre


Cette question est un moyen d’empêcher des soumissions automatisées de formulaires par des robots.
Smileys
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :!: :?: :idea: :arrow: :| :mrgreen: =D> #-o =P~ :^o :non: :priere: 8-|
Voir plus de smileys
  Revue du sujet
 

  Étendre la vue Revue du sujet : [RESOLU] integrer html dans php

Re: integrer html dans php

par quattro » 12 nov. 2017, 01:21

Merci

Re: integrer html dans php

par or 1 » 09 nov. 2017, 19:37

echo '<p id="rouge">'.$sport[$rand_keys3[0]].' </p>';

integrer html dans php

par quattro » 09 nov. 2017, 19:23

Bonjour
voici mon code :

Code : Tout sélectionner

$i = 0; while ($i <= $nbeleve) { $i++;//affecte nb d'eleves $nsport = rand(0,3);//affecte 0 à 3 sport/élève $sport = array('Aucun sport','Boxe','Foot','Tennis','Velo','Piscine');//création tableau sports switch ($nsport) { case 0: $zero = $sport[0];//Select aucun sport du tableau echo $zero .'</br>';//on affiche break; case 1: $rand_keys1 = array_rand($sport,1);//select 1 valeur au hazard du tableau $sport echo $sport[$rand_keys1] .'</br>';//on affiche var_dump($rand_keys1); break; case 2: $rand_keys2 = array_rand($sport,2);//select 2 valeurs au hazard du tableau $sport echo $sport[$rand_keys2[0]] .'</br>';//on affiche echo $sport[$rand_keys2[1]] .'</br>';//on affiche break; case 3: $rand_keys3 = array_rand($sport,3);//select 3 valeurs au hazard du tableau $sport echo $sport[$rand_keys3[0]] .'</br>';//on affiche echo $sport[$rand_keys3[1]] .'</br>';//on affiche echo $sport[$rand_keys3[2]] .'</br>';//on affiche break; }
je voudrais distinguer chaque CASE par une couleur, ex : case 0 en rouge, case 1 en vert, etc...
j'ai toujours du mal a integré du html dans le php.
je tente des choses du style :
echo '<p id="rouge">$sport[$rand_keys3[0]] </p>';
mais pas bon....