Who Will Help a Newby Like Me?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ben Sharvy

    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:gra y; text-align:center;}
    img {margin:10%;}
    </style>
    </head>

    <body>

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

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

    </body>
    </html>
  • Chung Leong

    #2
    Re: Who Will Help a Newby Like Me?


    "Ben Sharvy" <bsharvy@mac.co m> wrote in message
    news:d196ca8d.0 407102019.65f83 1a6@posting.goo gle.com...[color=blue]
    > 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:gra y; text-align:center;}
    > img {margin:10%;}
    > </style>
    > </head>
    >
    > <body>
    >
    > <? echo $_GET['showme'] ?>
    >
    > <img src= <? $_GET['showme'] ?> >
    >
    > </body>
    > </html>[/color]

    The correct shortcut for outputting a variable is <?= $_GET['showme'] ?>.
    You're missing the equal sign.


    Comment

    • Slawomir Jasinski

      #3
      Re: Who Will Help a Newby Like Me?

      Ben Sharvy wrote :[color=blue]
      > 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[/color]
      [color=blue]
      > <? echo $_GET['showme'] ?>
      >
      > <img src= <? $_GET['showme'] ?> >[/color]

      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

      Comment

      Working...