tabla, condición y jpg
Publicado por hans (1 intervención) el 13/10/2019 10:37:30
este es mi codigo ya no se que hacer, solo quiero cambia la imagen a rojo(imágenes/rojo.jpg) cuando la velocidad excede 60

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
<?php
$tab["1"]= array(rand(30,90));
$tab["2"]= array(rand(30,90));
$tab["3"]= array(rand(30,90));
$tab["4"]= array(rand(30,90));
$tab["5"]= array(rand(30,90));
$tab["6"]= array(rand(30,90));
$tab["7"]= array(rand(30,90));
$tab["8"]= array(rand(30,90));
$tab["9"]= array(rand(30,90));
$tab["10"]= array(rand(30,90));
$tab["11"]= array(rand(30,90));
$tab["12"]= array(rand(30,90));
$tab["13"]= array(rand(30,90));
$tab["14"]= array(rand(30,90));
$tab["15"]= array(rand(30,90));
$tab["16"]= array(rand(30,90));
$tab["17"]= array(rand(30,90));
$tab["18"]= array(rand(30,90));
$tab["19"]= array(rand(30,90));
$tab["20"]= array(rand(30,90));
?>
<table>
<tr><th>codigo<th>velocidad(km/s)<th>exceso<th>imagen
<?php
$i=0;
foreach($tab as $k=>$d){
if($d[0]>60){
$exceso=$d[0]-60;
$i++;
}else{
$exceso=0;
}
echo "<tr><td>$k<td>$d[0]<td>$exceso<td>";
?>
<img src="imagenes/verde.jpg" height="50" width="50">
<?php
}
?>
</table>

Valora esta pregunta


0