For each Statement help

4 posts by 2 authors in: Forums > CMS Builder
Last Post: January 25, 2016   (RSS)

I have this code:

<?php foreach ($downloadsRecord['icon_quickship'] as $index => $upload): ?>
<td valign="top">
<a href="<?php echo $upload['urlPath'] ?>"><img src="<?php echo $upload['urlPath'] ?>" alt="" width="<?php echo $upload['width'] ?>" height="<?php echo $upload['height'] ?>" border="0" align="center" style="margin-bottom:5px;"/></a>


<?php if (@$downloadsRecord['quick_ship']): ?>
<?php foreach ($downloadsRecord['quick_ship'] as $index => $upload): ?>
<center>
<a href="<?php echo $upload['urlPath'] ?>" target="_blank" class="style10">Brochure</a> </center><?php endforeach ?>
<?php endif ?></td>

<?php endforeach ?>

The problem with this is that the icon (first 'a href') links to the url of the icon image. I want it to link it to the quick_ship upload url (the second 'a href')

How do I rewrite that since they are different for each statements.

Thanks. Its perfect. Just  some typos in the code below, like  <?php endforach; ?> and <?php endif ?

But I was able to catch that. I also updated the first a href to this:

<a href="<?php echo $quick_ship_upload_url; ?>

from this:

 <a href="<?php echo $upload['urlPath'] ?>">

Always a pleasure with such quick responses.

By Damon - January 25, 2016

Thanks for catching those typos.

Will slow down just a little bit with my reply next time to give the code another look over before posting.  :)

Cheers,
Damon Edis - interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/