Ver Mensaje Individual
  #1 (permalink)  
Antiguo 22/12/2004, 06:59
Avatar de PHPmaruja
PHPmaruja
 
Fecha de Ingreso: diciembre-2004
Ubicación: Barcelona /España
Mensajes: 35
Antigüedad: 19 años, 4 meses
Puntos: 0
Como muestro una imagen con PHP

Hola,

Tengo el siguiente problema:

Quiero mostrar 2 imagenes aleatoriamente cada vez que se carge mi prog.php
vale?l

He comenzado por lo facil, jeje (osea, solo he puesto el rand();)
<?
$image = rand(1,2);
echo $image;
?>
<html>

<head>

<title>Muestro imagen </title>
</head>

<body>


<img border="0" src="C:\AppServ\www\images\146.gif" width="63" height="71">
</p>

</body>
</html>

Bueno, esto funciona pero cuando le digo que:

<?
$image = rand(1,2);
echo $image;
?>
<html>

<head>

<title>Muestro imagen </title>
</head>

<body>
<?php
if ($image == 1){
<img border="0" src="C:\AppServ\www\images\146.gif" width="63" height="71"></p>

}else{
if ($image == 2){
<img border="0" src="C:\AppServ\www\images\146.gif" width="73" height="71"></p>
}

}
?>
</body>
</html>

me da error ¿Como puedo escribir lo de <img...... > sin errores?.
Ah! Todavía no he llegado a los arrays (lo digo por si las moscas).

----- Pero no me importaría saber como hacerlo con arrays claro ----

Agradeceré vuestra ayuda

Gemma
__________________
Mambo, Joomla y CHA CHA CHA
Maruja de dia - webmaster de noche
http://www.PHPmaruja.es/

Última edición por PHPmaruja; 22/12/2004 a las 07:03