I'm new to PHP and trying to populate the contents of a flat file to a dropdown box. Clearly haven't a clue what I am doing, but here is what I have tried so far. The first part is there to confirm that I am actually opening the file and that there is something in it. And there is!
$fh = fopen("data.txt", "r");
while (!feof($fh) ) {
$line_of_text = fgets($fh);
$parts = explode('=', $line_of_text);
echo $parts[0] . $parts[1]. $parts[2] . "<BR>";
}
// attempt to populate a dropdown list
echo "<select name=\"$parts\">\n";
foreach($fh as $parts) {
echo "($name, id, $choice, $part)\n";
}
echo "</select>\n";
Thaks for any suggestions.