ironman32 Posted March 24, 2009 Share Posted March 24, 2009 I've tried to create an array list that contains an external link. I was unsuccessful and was wondering if anyone knew if this can be done. Here's what i've done so far <?php $shoulder_array[0] = <"http://www.muscleandstrength.com/exercises/military-press.html">"Military press"</a>; ?> <html> <body> <table border="1"> <tr><td rowspan="2">Day 1</td> <td>Stretch/Warm up </td><td><?php echo $shoulder_array[0]; ?></td></tr> </table> </body> </html> Any help would be appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/150926-solved-html-links-in-a-php-array-list/ Share on other sites More sharing options...
wildteen88 Posted March 24, 2009 Share Posted March 24, 2009 You place your html within the quotes not outside of it $shoulder_array[0] = '<a href="http://www.muscleandstrength.com/exercises/military-press.html">Military press</a>'; // OR $shoulder_array[0] = "<a href=\"http://www.muscleandstrength.com/exercises/military-press.html\">Military press</a>"; Quote Link to comment https://forums.phpfreaks.com/topic/150926-solved-html-links-in-a-php-array-list/#findComment-792904 Share on other sites More sharing options...
Yesideez Posted March 24, 2009 Share Posted March 24, 2009 Think how a link is formed... <a href="link_here">text here</a> So you can use... <td><a href="<?php echo $shoulder_array[0]; ?>"><?php echo $shoulder_array[0]; ?></a></td> Quote Link to comment https://forums.phpfreaks.com/topic/150926-solved-html-links-in-a-php-array-list/#findComment-792905 Share on other sites More sharing options...
Yesideez Posted March 24, 2009 Share Posted March 24, 2009 Sometimes this scrolly mouse wheel bugs me - I scrolled down and the link in your code shot off the top of the frame. Quote Link to comment https://forums.phpfreaks.com/topic/150926-solved-html-links-in-a-php-array-list/#findComment-792909 Share on other sites More sharing options...
Floydian Posted March 24, 2009 Share Posted March 24, 2009 Just to add to wildteen98, $shoulder_array[0] hasn't been initialized as an array. Put this first: $shoulder_array = array(); And then doing $shoulder_array[0] = ......... will be better. <?php $shoulder_array = array(); $shoulder_array[0] = '<"http://www.muscleandstrength.com/exercises/military-press.html">"Military press"</a>'; Quote Link to comment https://forums.phpfreaks.com/topic/150926-solved-html-links-in-a-php-array-list/#findComment-792911 Share on other sites More sharing options...
ironman32 Posted March 24, 2009 Author Share Posted March 24, 2009 Thanks for all the help guys. Quote Link to comment https://forums.phpfreaks.com/topic/150926-solved-html-links-in-a-php-array-list/#findComment-793107 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.