Jump to content

[SOLVED] html links in a php array list


ironman32

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/150926-solved-html-links-in-a-php-array-list/
Share on other sites

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>";

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>';

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.