I have been trying to figure out how to populate a html template with data from a multi dimensional array, but i cant figure it out. The template is taken from MySQL.
This is what I have:
$template=addslashes($row['content']);
eval("\$body=\"$template\";");
print($body);
Now the template is as follows:
$row['content'] = "<html><p>array item one $arr[0][0]</p><p>array item two $arr[0][1]</p></html>"
...and the array ($arr):
Array ( [0] => Array ( [0] => 1 [1] => 6 ) )
The result is:
$body = <html><p>array item one Array[0]</p><p>array item two Array[1]</p></html>
...as opposed to what I expected:
$body = <html><p>array item one 1</p><p>array item two 6</p></html>
I can get this to work fine with 'solo variables' but it just wont return 'array variables'...
Anyone have any ideas where I am going wrong? I appologise in advance for my limited knowledge, im still learning. :)