I have following php code which create Drop-Down menu reading text file which contain name
files.txt
JAMES
MARK
TONY
drop-down.php
<?php
$path = "files.txt";
$file = fopen($path, 'r');
$data = fread($file, filesize($path));
fclose($file);
$lines = explode(PHP_EOL,$data);
echo '<select name="file">';
foreach($lines as $line) {
echo '<option value="'. urlencode($line).'">'.$line.'</option>';
}
echo '</select>';
?>
Here is the POST section of code, it is a loop
foreach ($_POST["bname"] AS $id => $value)
{
...
...
USERNAME: "'.$_POST["file"][$id].'"
Everything working but when i submit data to other form i am getting only first letter of users like if i select JAMES
and submit data i am only getting J
letter in .$_POST
. I want Full name JAMES
, what is wrong in my code?