Quantcast
Channel: UNIX and Linux Forums
Viewing all articles
Browse latest Browse all 16232

Php assign selection to a variable

$
0
0
can someone help me assign the selection of a drop down menu to a variable? the variable i need to store the selection in is scanoption.

Code:

<form name="scanoption">
<p align="center">
<p align="center">Name: <input name="scanoption" type="text" size="45">
<select>
<?php
if ($handle = opendir('/var/tmp')) {
    while (false !== ($entry = readdir($handle))) {
        if ($entry != "." && $entry != "..") {
            $list[] = $entry;
        }
    }
    closedir($handle);
}
natcasesort($list);
sort($list);
foreach($list as $file) {
        echo "<option value='$file'>$file</option> \n";
        #echo "<input name="scanoption" type="text" size="45">";
        $scanoption = '$file';

}
?>
</select>

can anyone help with this?

Viewing all articles
Browse latest Browse all 16232

Trending Articles