Reply to Using an as a link

Your name:

Reply:


Posted by Denebola on 02/12/06 06:31

Now I am able to practice php on my pc, thanks to previous replies to a
post in this forum, here the first of many questions.

I want to be able to use an image as a link. So in html I would use:

<a href="http://www.somepage.com">
<img src="someimage.jpg">
</a>

I have written the php code below (which I am proud of !!):

<?php

// Switch statement based off server time
switch (date('H i D'))
{
case '22 33 Sat':
print '<img src="michelle.jpg" border="2" height="170"
width="227" />';
break;

case '22 34 Sat':
print '<img src="sunset.jpg" border="2" height="170"
width="227" />';
break;

default:
print 'Cases not met';

}

?>

Now the code above does what I want it to do but if I add the line
below i get a parse error:

case '22 35 Sat':
print '<a href="http://www.somepage.com"><img
src="someimage.jpg"></a>';
break;

So how do I create a link from the images in my code?

Regards

p.s. please excuse the unintentional line breaks in the above code but
they are not there in the actual code I have written.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация