Hello to all,
I am trying to retrieve data generated in a php script to put into my html page. The problem I am having is that the data is not being returned. It is not a problem of connection: I have tested them and they work. I think my problem may lie in the use of the function “header()” in my php script. I am not sure how to return the text generated from my php script. Here is the php code I am using:
[code=php] header( ‘Content type:text/plain’) ;
while( $row = mysql_fetch_assoc($result) )
{
foreach ($row as $col)
{
echo “<option>$col</option>”;
}
}
I am trying to link this back up with my html page with the following code
[code=html] // select tag
var selectTag = document.getElementById(“locusSelect”) ;
if( xmlRequest.status == 200 )
{
// put info into select tag
selectTag.innerHTML = xmlRequest.responseText ;
//alert(“Page Found”) ;
}
The output of my php script looks like this:
[CODE]Warning: Cannot modify header information – headers already sent by (output started at /Users/Greg/Sites/homework7-8/getLoci.php:10) in /Users/Greg/Sites/homework7-8/getLoci.php on line 12
<option>A12345</option><option>B23456</option><option>C34567</option>
Note: line 12 is the header() function
I am not sure what I am doing wrong. I am trying to return a list of names from a database to input as options in a select tag upon loading of page.
Any help would be great