How do i store select value into a php variable

php

Solution

in somephpfile.php

$selected = $_POST['somename'];

html

 <form action="somephpfile.php" method="post"> 
    <div id="select">
    <select class="select">
    <select name="somename"> <!-- you missed this -->
      <option value="year 1">year 1</option>
      <option value="year 2">year 2</option>
      <option value="year 3">year 3</option>
    </select>
    </div>
    </form>

Problem

i have a simple drop down select menu. ``` <div id="select"> <select class="select"> <option value="year 1">year 1</option> <option value="year 2">year 2</option> <option value="year 3">year 3</option> </select> </div> ``` How do i take the value that the user selects and store it into a php variable?

Original source