PHP: Drop down select list

This entry is part 49 of 54 in the series PHP Tutorial

To get the value from the selected list, it is a lot more straight forward using PHP.

Once an item, in this case selectitem is selected, the value of selectitem will be passed to the php code to be printed out.

Did you notice that a selected list is a name value pair?

<form method="post" action="">
    <select name="selectitem">
        <option value="bmw">BMW</option>
        <option value="renault">Renault</option>
        <option value="toyota">Toyota</option>
    <input type="submit" value="send">
if (isset($_POST['selectitem'])) {
    print $_POST['selectitem'];

You can try the drop down form here.

Series Navigation<< PHP: Print_r & var_dump
PHP: Creating a dropdown list using PHP >>

Leave a comment

Leave a Reply