luskbo Posted June 26, 2010 Share Posted June 26, 2010 I have a question that I hope someone can help me with. I have a website that I am loading dynamic content from a database. In my files and instruction I reference the contact page, that is only because that is the file I have been testing this on. Here is how it works: contact page has a php text box that sends an onclick value to a javascript function. the js functions sends the variable (q) to a php file. that php file queries a database that has my listing in it. the php file then echos the database values into html to the calling contact page. The problem is that this works fine in firefox, but nothing is displayed in IE. here is my getList.php file. This is called from the contact page. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>lsimpson.com Beta</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <link rel="stylesheet" href="contact.css" type="text/css" /> <script src="Scripts/swfobject_modified.js" type="text/javascript"></script> </head> <body> <?php $q=$_GET["q"]; $con = mysql_connect('localhost', '********', '********'); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("jlusk_residential", $con); $sql="SELECT * FROM resi_list WHERE id = '".$q."'"; $result = mysql_query($sql); while($row = mysql_fetch_array($result)) { echo'<div id="imgDiv">'; echo'<div id="topimg"><img src='. $row['img1'] .' border=0></div>'; echo'<div id="botPics">'; echo'<div id="smallImg1"><img src=' . $row['img2'] . ' border=0></div>'; echo'<div id="smallImg2"><img src=' . $row['img3'] . ' border=0></div>'; echo'<div id="smallImg3"><img src=' . $row['img4'] . ' border=0></div>'; echo'</div>'; echo'</div>'; } mysql_close($con); ?> </body> </html> Here is the JS that sends the variable to the getList.php This segment of code comes from the contact.php page. You can view the entire source if you view source of the page. { if (str=="") { document.getElementById("imgDiv").innerHTML=""; return; } if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("imgDiv").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","getList.php?q="+str,true); xmlhttp.send(); } This is driving me crazy. At first I thought that the problem was my single quotes in the php echo statements, but after changing them to double quotes, and using escape (\) chars in the actualy html code, I think I ruled that out as a problem. Also I have even tried to use html tables to make this display, and that did not work as well. Here are the links to my site where I'm testing it at. http://lsimpson.luskbo.com/contact.php To replicate the problem, all you have to do is go to the page, and select the first or second option in the list box at the bottom. Only 1 and 2 work, which is correct, since that is all that is in the database. The images will change in the upper right of the page. As you will see, it works in FF, but not IE8. Any ideas?? Link to comment https://forums.phpfreaks.com/topic/205957-problem-with-ie-displaying-php-echo-statements/ Share on other sites More sharing options...
luskbo Posted June 27, 2010 Author Share Posted June 27, 2010 Its always the little stuff you overlook.... echo"<option style='width: 170px;'value=" . $row['id'] . ">" . $row['id'] . "</option>"; works like a charm. Thanks alot. Now both browsers are happy. Link to comment https://forums.phpfreaks.com/topic/205957-problem-with-ie-displaying-php-echo-statements/#findComment-1077764 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.