PHP Get selected Values on a drop down list
<p>I have this script that displays the year, month and day on a drop down.</p>

<p>my question is: how do I get the selected values in the format of d-m-y?</p>

<p>let's say if i will have a button to get the current selected values and display on a textbox. how would i do it?</p>

<p>any ideas are greatly appreciated. Thank you.</p>

<pre><code>&lt;html&gt;
    &lt;body&gt;
&lt;?php
    $months = array(
            'January', 
            'February', 
            'March', 
            'April', 
            'May', 
            'June',
            'July', 
            'August', 
            'September', 
            'October', 
            'November',
            'December'
        );
    $weekday = array(
            'Sunday',
            'Monday',
            'Tuesday',
            'Wednesday',
            'Thursday',
            'Friday',
            'Saturday'
        );
    $days = range(1,31);
    $years = range (2010, 2020);

    $currentDay = date('d');
    $currentMonth = date('F');
    $currentYear = date('Y');

    echo "&lt;select name='weekday'&gt;";
    foreach($days as $valued) {

        if($valued == $currentDay)
        { 
            $default = 'selected="selected"'; 
            echo '&lt;option '.$default.' value="'.$valued.'"&gt;'.$valued.'&lt;/option&gt;\n';
        } else {
            $default='';
            echo '&lt;option '.$default.' value="'.$valued.'"&gt;'.$valued.'&lt;/option&gt;\n';
        }
        } 
    echo '&lt;/select&gt;&amp;nbsp;';
        echo "&lt;select name='month'&gt;";
        foreach($months as $valuem) {
            if($valuem==$currentMonth)
        { 
            $default1 = 'selected="selected"';
            echo '&lt;option '.$default1.' value="'.$valuem.'"&gt;'.$valuem.'&lt;/option&gt;\n';
        } else {
            $default1 = '';    
            echo '&lt;option '.$default1.' value="'.$valuem.'"&gt;'.$valuem.'&lt;/option&gt;\n';
        }

    } 
        echo '&lt;/select&gt; &amp;nbsp; ';
        echo "&lt;select name='year'&gt;";

        foreach ($years as $valuey) {

    if($valuey == $currentYear)
    { 
       $default2 = 'selected="selected"';
       echo '&lt;option '.$default2.' value="'.$valuey.'"&gt;'.$valuey.'&lt;/option&gt;\n';
    } else {
           $default2 = '';
           echo '&lt;option '.$default2.' value="'.$valuey.'"&gt;'.$valuey.'&lt;/option&gt;\n';
    }

        }  
        echo '&lt;/select&gt; &amp;nbsp; ';
?&gt;


&lt;/body&gt;
&lt;/html&gt;
</code></pre>
