Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

My php question is stupider than yours

0 views
Skip to first unread message

Robot Tree

unread,
Jul 22, 2003, 9:47:21 AM7/22/03
to
Hi Everybody!!

I'm trying to get this php code to work, and I keep getting this
error...there may be other problems with the code, but a parse error sounds
like a syntax problem to me (I'm a beginner)...I would be so happy if
somebody could help me fix it!!

"Parse error: parse error, unexpected T_STRING in
d:\websites\stevedurkinnet\wwwroot\TMPbjeclick0n.php on line 27"

Line 27 is the first of the 25 lines that look like this: <a href="problem
lies somewhere in here"></a>.

(I'm developing a decent understanding of some of the variables and how they
interact, but I don't understand the purpose of the $alt variable or the
&amp thing that separates the href="XXXXXX" from the alt="XXXXXX," so if
anybody could explain that stuff too I'd be so happy.) As you may notice,
this code is for a single web page in which the one image displayed can be
changed by clicking on each of 25 links to corrresponding images.

Thanks so much for lookin',
RT

Here is the code:

<html>
<head>
<title>Paintings</title>
<link href="Style Sheets/Style01.css" rel="stylesheet" type="text/css">
</head>

<body>
<div align="center">

<?PHP
if(!isset($pn)) {
$pn = "Animals.gif";
$alt = "picture one";
}

$path = "Images\Paintings\";
$picname = $path.$pn;
$pic_size = getimagesize($picname);

print(<p>);
print(<img src=\"$picname\" $pic_size[3] alt=\"$alt\">);
print(</p>);
?>

<p>
<a href="Paintings.php?pn=Animals.gif&amp;alt=picture%20one">Animals</a> |
<a
href="Paintings.php?pn=Antimatter.gif&amp;alt=picture%20two">Antimatter</a>
|
<a href="Paintings.php?pn=Battle.gif&amp;alt=picture%20three">Battle</a> |
<a href="Paintings.php?pn=Bear.gif&amp;alt=picture%20four">Bear</a> |
<a href="Paintings.php?pn=Bird.gif&amp;alt=picture%20five">Bird</a> |
<a href="Paintings.php?pn=Cabin.gif&amp;alt=picture%20six">Cabin</a> |
<a href="Paintings.php?pn=Castle.gif&amp;alt=picture%20seven">Castle</a> |
<a href="Paintings.php?pn=City.gif&amp;alt=picture%20eight">City</a> |
<a href="Paintings.php?pn=Colorado.gif&amp;alt=picture%20nine">Colorado</a>
|
<a
href="Paintings.php?pn=Droidling%20and%20Mother.gif&amp;alt=picture%20ten">D
roidling and Mother</a> |
<a href="Paintings.php?pn=Dude.gif&amp;alt=picture%20eleven">Dude</a> |
<a
href="Paintings.php?pn=Eating%20Demon.gif&amp;alt=picture%20twelve">Eating
Demon</a> |
<a href="Paintings.php?pn=Faces.gif&amp;alt=picture%20thirteen">Faces</a> |
<a href="Paintings.php?pn=House.gif&amp;alt=picture%20fourteen">House</a> |
<a href="Paintings.php?pn=Path.gif&amp;alt=picture%20fifteen">Path</a> |
<a href="Paintings.php?pn=Phantom.gif&amp;alt=picture%20sixteen">Phantom</a>
|
<a href="Paintings.php?pn=Plan.gif&amp;alt=picture%20seventeen">Plan</a> |
<a href="Paintings.php?pn=Skull.gif&amp;alt=picture%20eighteen">Skull</a> |
<a
href="Paintings.php?pn=Snowman.gif&amp;alt=picture%20nineteen">Snowman</a> |
<a href="Paintings.php?pn=Star.gif&amp;alt=picture%20twenty">Star</a> |
<a href="Paintings.php?pn=Tree.gif&amp;alt=picture%20twentyone">Tree</a> |
<a href="Paintings.php?pn=Vortex.gif&amp;alt=picture%20twentytwo">Vortex</a>
|
<a href="Paintings.php?pn=Warp.gif&amp;alt=picture%20twentythree">Warp</a> |
<a
href="Paintings.php?pn=Wizard.gif&amp;alt=picture%20twentyfour">Wizard</a> |
<a href="Paintings.php?pn=Wolf.gif&amp;alt=picture%20twentyfive">Wolf</a>
</p>

</div>
</body>
</html>


Nikolai Chuvakhin

unread,
Jul 22, 2003, 1:34:16 PM7/22/03
to
"Robot Tree" <st...@stevedurkin.net> wrote in message
news:<TebTa.24150$b03.23697@lakeread03>...

>
> I'm trying to get this php code to work, and I keep getting this
> error...there may be other problems with the code, but a parse error sounds
> like a syntax problem to me (I'm a beginner)...I would be so happy if
> somebody could help me fix it!!
>
> "Parse error: parse error, unexpected T_STRING in
> d:\websites\stevedurkinnet\wwwroot\TMPbjeclick0n.php on line 27"

Change this:

> print(<p>);
> print(<img src=\"$picname\" $pic_size[3] alt=\"$alt\">);
> print(</p>);

into this:

print '<p>';
print "<img src=\"$picname\" $pic_size[3] alt=\"$alt\">";
print '</p>';

Cheers,
NC

<>

unread,
Jul 23, 2003, 4:34:42 PM7/23/03
to
"Nikolai Chuvakhin" <n...@iname.com> wrote in message
news:32d7a63c.0307...@posting.google.com...

Absolutely correct advise. However, your HTML is invalid as well. The "&amp
thing" you refer to is actually &amp; (the encoded version of ampersand),
which does not belong there. Change (for example) this:


> <a href="Paintings.php?pn=Animals.gif&amp;alt=picture%20one">Animals</a>

into this:
<a href="Paintings.php?pn=Animals.gif" alt="picture one">Animals</a>

HTH!


0 new messages