By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,747 Members | 2,039 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,747 IT Pros & Developers. It's quick & easy.

Who Will Help a Newby Like Me?

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a

"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

P: n/a
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.