467,104 Members | 1,024 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,104 developers. It's quick & easy.

Who Will Help a Newby Like Me?

I can't get the following page to display the img, whose name is
passed in the URL. The variable, showme, is the name of a jpg file
(e.g., coolpict.jpg). It is being passed correctly, as verified by the
echo line (only there for testing purposes), but it doesn't get
translated in the img tag.

<html>

<head>
<title>Images</title>
<style type="text/css">
body {background:gray; text-align:center;}
img {margin:10%;}
</style>
</head>

<body>

<? echo $_GET['showme'] ?>

<img src= <? $_GET['showme'] ?> >

</body>
</html>
Jul 17 '05 #1
  • viewed: 1284
Share:
2 Replies

"Ben Sharvy" <bs*****@mac.com> wrote in message
news:d1**************************@posting.google.c om...
I can't get the following page to display the img, whose name is
passed in the URL. The variable, showme, is the name of a jpg file
(e.g., coolpict.jpg). It is being passed correctly, as verified by the
echo line (only there for testing purposes), but it doesn't get
translated in the img tag.

<html>

<head>
<title>Images</title>
<style type="text/css">
body {background:gray; text-align:center;}
img {margin:10%;}
</style>
</head>

<body>

<? echo $_GET['showme'] ?>

<img src= <? $_GET['showme'] ?> >

</body>
</html>


The correct shortcut for outputting a variable is <?= $_GET['showme'] ?>.
You're missing the equal sign.
Jul 17 '05 #2
Ben Sharvy wrote :
I can't get the following page to display the img, whose name is
passed in the URL. The variable, showme, is the name of a jpg file <? echo $_GET['showme'] ?>

<img src= <? $_GET['showme'] ?> >


Try <img src="<?php echo $_GET['showme']?>" alt="">

If you have in php.ini
short_open_tag = On

You can use

<img src="<?= $_GET['showme']?>" alt="">

--
regards Slawomir Jasinski
http://www.jasinski.us | http://www.cgi.csd.pl | http://www.gex.pl
Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

9 posts views Thread by Damien | last post: by
reply views Thread by Pete | last post: by
reply views Thread by marco | last post: by
8 posts views Thread by Ask | last post: by
10 posts views Thread by Fred Nelson | last post: by
4 posts views Thread by Fred Nelson | last post: by
4 posts views Thread by Fred Nelson | last post: by
2 posts views Thread by Fred Nelson | last post: by
2 posts views Thread by johnnyG | last post: by
10 posts views Thread by Charles Russell | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.