-1

I know it may sound stupid, but im trying to echo an image that i get his name from the url, i dont get anything only the alt text of the image.

This is my code

<?php
$url =  $_GET["userpic"];
$DisplayImg = "./Imagenes/".$url.".jpg";
?>
<html>
<body>

<img src="<?php echo $DisplayImg; ?>" alt="Error" width="100%" height="100%" border="0" /> 
</body>
</html>
Dante
  • 34
  • 10

2 Answers2

1

Try this:

<html>
<body>
<img src="../Imagenes/<?php echo $_GET["userpic"]; ?>.jpg" alt="Error" width="100%" height="100%" border="0" /> 
</body>
</html>

If that still dont work then your path is wrong you can see it by adding

<?php echo "<a href='../Imagenes/".$_GET["userpic"].".jpg'>this should link to your image</a>"; ?>
1

Dante,

Change the extension to .php instead of .html

If you want to run a php code into a .html refer to How do I add PHP code/file to HTML(.html) files?

Community
  • 1
  • 1
ledesma
  • 248
  • 1
  • 7
  • 18
  • Thanks, i had a html, because i was making things with google charts javascript and other stuff and because and i am newbie in that, i didnt know i could make all in a php file, thanks you so much – Dante May 05 '15 at 20:13