Hi
I am having serious problems trying to figure out a little problem I have. Basically I want to read from a text file which is in the following format:
name surname
name2 surname2
name3 surname3
Now I want to find someone's surname given the name from the text file and I did the following:
<?php
$fp = fopen("c:/one/test.txt", "rb");
while($info = fscanf($fp, "name2\t%s\n")){
list($surname) = $info;
echo $surname;
}
fclose($fp);
?>
This works and the right surname is echoed. However, if I try to use $surname anywhere else on the page ie emailing it, I dont see anything. I think its in the list somehow, but cant figure out how to sort it out.
Is there a better way to do this?
Thanks