hehehe
hehehe

Reputation: 1

echo the selected value from the dropdown menu?

I have a form and here is code for the dropdown menu. Can you help me make a code to show the selected value after submitting the form? im using php

<select name="professional" />
            <option value="">Choose one</option>
                <?php 
                    $result2 = mysql_query("SELECT * FROM professional");
                    while($row2 = mysql_fetch_array($result2))
                    {
                        $prc = $row2['name'];
                        $prof = $row2['prcno'] ."\t"."|\t".  $row2['name'] ."\t"."|\t".$row2['profession'];
                        echo "<option value ='$prc'>$prof</option>";
                    }

                ?>
            </select>

Upvotes: 0

Views: 3106

Answers (1)

daghan
daghan

Reputation: 1028

<?php
echo $_REQUEST['professional'];
?>

you might wish to use $_GET or $_POST instead of $_REQUEST, please check: http://php.net/manual/en/reserved.variables.request.php

Upvotes: 1

Related Questions