Forum Moderators: coopster
function DoMenus()
{
foreach($tm_names as $tm_name)
{
echo "<tr><td>". $tm_name . "</td></tr>";
}
}
?>
<body>
<table>
<?php
// This succeeds!
foreach($tm_names as $tm_name)
{
echo "<tr><td>". $tm_name . "</td></tr>";
}
// This fails!
Echo DoMenus();
?>
</table>
</body>
==========================
Thanx so much!
PeterC
function DoMenus()
{
global $tm_names;
foreach($tm_names as $tm_name)
{
echo "<tr><td>". $tm_name . "</td></tr>";
}
}
Or, pass $tm_names as an argument to it:
---
function DoMenus($tm_names)
{
foreach($tm_names as $tm_name)
{
echo "<tr><td>". $tm_name . "</td></tr>";
}
}
DoMenus($tm_names)
---
Following on from this, I have been using innerHTML to place my array in the required celly 'dynamically' meaning that if I click a button, the text will update without refreshing the page.
What is now happening, is that I am having trouble with the tag styles / parameters in the innerHTML, if I just use a simple <tag> then all is ok, but if I use parameters, the innerhtml fails i.e.:
This creates a on-cell clickable table:
<table><tr><td onclick=location.href= 'http://www.yahoo.com';>Click</td></tr></table>
This is a button with innerHTML copied from the table above, it fails:
<INPUT onclick="contents.innerHTML='<table><tr><td onclick=location.href= 'http://www.yahoo.com';>Click</td></tr></table>';" type='button' value='Button' name='B2'>
<span id="contents"></span>
This is the same button but with the parameters stripped out, it generates the table but obviously is not clickable!:
<INPUT onclick="contents.innerHTML='<table><tr>Click</td></tr></table>';" type=button value=Button name=B1>
I've spent many hours changing syntax and searching google, but can't seem to find an answer?
Thanx
PeterC