I have two text boxes (textbox1 and textbox2) and a csv file. Textbox1 corresponds to column 0 in the csv and similarly for textbox2 to column 1. I want to type a letter into textbox1, have it search through column 0 for a match of the first letter of that field and then once it finds a match, populates the corresponding value in textbox2. For example:
Col0, Col1 Dan, Smith Andrew, White Matt, Stevens
If I type a "d" in textbox1 it should populate textbox2 with "Smith"
Here is the code I have so far:
var textBox = document.getElementById("firstName");
var textBox2 = document.getElementById("lastName");
var theValue = textBox2.value;
for(var i=0;i<15;i++)
{
(open php tag) $a++; (close php tag)
for(var j=0;j<3;j++)
{
theArray[i][j]=
(open php tag)
$fp = fopen('data.csv', 'r');
$data = array();
$b++;
while($row = fgetcsv($fp))
$data[] = $row;
echo $data[$a][$b];
(close php tag)
if(theArray[0][j].substring(0,1)==theValue)
textBox.value = theArray[1][j];
}
Something tells me incrementing $a
in a separate php tag wont talk with the other php tag. Yes/no?
Any help with this getting this code working would be much appreciated. Thanks in advance.