Php assign selection to a variable

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 inputA.

<form name="inputA">
<p align="center">
<p align="center">Name: <input name="inputA" 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="inputA" type="text" size="45">";
        $scanoption = '$file';

}
?>
</select>

can anyone help with this?

If you give your select a name then when the user submits the form the selected value will be in the _POST array.

e.g. something like:

if ($_SERVER['REQUEST_METHOD'] === 'POST') {
   $inputA=$_POST['dir_name']
}
else { /* REQUEST */
?>
<form name="inputA">
 <p align="center">
  <select name="dir_name">
etc...