micahraney56
New Member
- Messages
- 44
- Reaction score
- 0
- Points
- 0
Can someone please tell me what's wrong with my code?
I'm beginning PHP and MySQL and I'm trying to take my information (about a soldier in the example) that already exists and put it in a table. I also want to get it so I can add more.
I know my echo statements work because I viewed the source on my page. What happens is that the text that I want to appear in the table appears above it with no formatting. I can't figure out why JavaScript won't
A) put my text inside the DIV tag and
B) put my text in a table
I'm beginning PHP and MySQL and I'm trying to take my information (about a soldier in the example) that already exists and put it in a table. I also want to get it so I can add more.
Code:
<head>
...
<script type="text/javascript">
function changeText(){
document.getElementById("PHPHere").innerHTML = '<tr><td><? echo"$id";?></td><td><? echo"$LastName, $FirstName";?></td><td><? echo"$Specialty";?></td><td><? echo"$Rank";?></td></tr>';
}
</script>
</head>
<body onload="changeText();">
<BR /><BR />
<table border="1" name="table">
<tr>
<td>#</td>
<td>Last Name, First Name</td>
<td>Specialty</td>
<td>Rank</td>
</tr>
<div id="PHPHere">
</div>
</table>
I know my echo statements work because I viewed the source on my page. What happens is that the text that I want to appear in the table appears above it with no formatting. I can't figure out why JavaScript won't
A) put my text inside the DIV tag and
B) put my text in a table