-7

I was doing that when i select a name from combo box then data related to the selected name should be shown from mysql table using ajax. But it could not be done.

<html>
<head>
<script>
function showUser (str)
{
    if(str=="")
    {
        document.getElementById("txtHint").innerHTML=="";
        return;
    }
    if(window.XMLHttpRequest)
    {
        xmlhttp=new XMLHttpRequest();
    }
    else
    {
        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
    xmltttp.onreadystatechange=function()
    {
        if (xmlhttp.readyState==4 && xmlhttp.status==200)
        {
            document.getElementById("txtHint").innerHTML=xmlhttp.responseText;

        }
    }
    xmlhttp.open("GET","getuser.php?q="+str,true);
    xmlhttp.send();
}
</script>
</head>
<body>
<form>
<select name="users" onchange="""showUser(thiis.value)">
<option value="">Select a person</option>
<option value="1">Peter Griffin</option>
<option value="2">Lois Griffin</option>
<option value="3">Glenn Quagmire</option>
<option value="4">Joseph Swanson</option>
</select>
</form>
<br>
<div id="txtHint">Person List is Here</div>
</body>
</html>

Its shows a notice

please delete me
  • 311
  • 2
  • 4
  • 8

1 Answers1

3

That's because you're not reading a CSV file, the byte-pattern of the data you show suggests an OLE wrapper containing BIFF data.... ie. it's probably a genuine Excel .xls file. Try opening the file in MS Excel (rename as .xls if necessary) or Gnumeric or Open/Libre Office Calc.

To process the file in PHP, you'll need a PHP library capable of reading Excel xls files: in addition to PHPExcel, you can find a list of other libraries here.

Community
  • 1
  • 1
Mark Baker
  • 209,507
  • 32
  • 346
  • 385
  • If indeed so: good catch. Do you still see the code, or only blondes and brunettes? ;) – deceze Jan 17 '13 at 08:54
  • 1
    @deceze - A binary stream is indeed a thing of beauty, and you can see patterns in the data... sadly not blondes, brunettes or even redheads. – Mark Baker Jan 17 '13 at 08:58
  • 1
    The key is in the ÐÏà heading, and in the use of ÿ as a stream padding character – Mark Baker Jan 17 '13 at 08:59
  • From your profile I see you have been intimately studying the Office file formats... my hat off to you. And *ÐÏà* is a nice name for a redhead. ;) – deceze Jan 17 '13 at 09:01
  • I'll remember it as a name if my nextborn is a redhead :) – Mark Baker Jan 17 '13 at 16:58