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.co m">
<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.j pg" 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.co m"><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.
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.co m">
<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.j pg" 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.co m"><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.
Comment