set values as a variable of select tag in php
<p>I want to set both values as variable. Means if I want to use sales or training as a variable and if I want to use its value anywhere then I can use it.</p>

<pre><code>&lt;form action="code.php" method="post"&gt;
    &lt;select name="department"&gt;  
        &lt;option&gt;Please Choose Department&lt;/option&gt;
        &lt;option value="sales"&gt;Sales&lt;/option&gt;
        &lt;option value="training"&gt;Training&lt;/option&gt;
    &lt;/select&gt;
    &lt;input type="submit" value="submit"&gt;
&lt;/form&gt;
</code></pre>

<p>I am trying by below code but I can't. </p>

<p><strong>code1.php</strong></p>

<pre><code>&lt;?php
    $stud = explode("_", $_POST['department']);
    $sales = $stud[0];
    $training = $stud[1];
    echo "$sales";
    echo "$training";
?&gt;
</code></pre>

<p><code>$sales</code> and <code>$training</code> are not working as variable.</p>

<p>Please help.</p>