I am creating a list of images dynamically, following is the code

                        <?php 
                        for ( $counter = 0; $counter < $obj1->id; $counter ++)
                        { ?>
                            <tr><td> Week <?php echo($counter+1); ?></td><td><?php echo" <a href=\"#hiddenDiv\" rel=\"facebox\";>";?><img src="tue.png"/></a></td></tr>
                        <?php } ?>

when the user clicks on the image a form opens. every image represents a week so i need to uniquely identify on which week user is inserting data. i need id of that image through which i can identify a week

Thanks in advance

Member Avatar for stbuchok

You will probably want to move this to the PHP forum as this the JavaScript Forum.

However, it is probably something like this (I don't actually know PHP):

 <?php 
    for ( $counter = 0; $counter < $obj1->id; $counter ++)
    { ?>
    <tr><td> Week <?php echo($counter+1); ?></td><td><?php echo" <a href=\"#hiddenDiv\" rel=\"facebox\";>";?><img id="image_<?php echo($counter+1); ?>" src="tue.png"/></a></td></tr>
<?php } ?>

Or something like that.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.