views:

18

answers:

1

Hi,

I'd like to generate automatically an imagemap, but I always get a parse error without any other detail (that's useful.) than the location. Am I not using well ?

Here is the code :

<?php
//Some code
?><map name="mymap"><?php
foreach($rects as $rect) {
    ?>
    <area shape="rect" coords=<?php echo '"'.$rect['x1'].','.$rect['y1'].','.$rect['x2'].$rect['y2'].'"'; ?> onclick="http://en.wikipedia.org/"/&gt;
    <?php
}
?></map>
<img src="image.png" usemap="#mymap"/>

Thanks aforehand.

Regards,

Mister Mystère

+1  A: 

Looks like you're missing a comma between $rect['x2'].$rect['y2'].

Archimedix
Yes, but that wouldn't result in a PHP parse error, since the PHP syntax for that is fine (but it is a logic error in the generated HTML)...
ircmaxell
There is no PHP parse error for me in the code shown in the question, so I guessed he meant a parse error of the generated markup / image map. The only place there for a parse error would be where the comment `//Some code` is.
Archimedix
I had simplified the code to post, and after seeing what you said, I decided to build the code around this piece of code, and it worked. So, basically, I don't know where the error came from, but now it's gone... However, I indeed had forgot the comma, and it helped me understand why it displayed the image without making the map work, so I give you a tick anyway ^^
Mister Mystère