Tedd's Simple Dropdown Menu


Choice:
Array
(
)
 

CODE FOLLOWS

<?php
    
    
include('includes/header.php');
    
    
$option '';
    
$s ' SELECTED ';
    
    if (isset(
$_POST['option']))
    {
        
$option $_POST['option'];
    }
?>

<h1>Tedd's Simple Dropdown Menu</h1>

<div class="full"> <!-- start of content -->
    <form action="" method="post">
        <fieldset>
            <select name="option">
                <option value="A" <?php if ($option== 'A')
                {
                    echo(
$s);
                } 
?> >Choice A
                </option>
                <option value="B" <?php if ($option== 'B')
                {
                    echo(
$s);
                } 
?> >Choice B
                </option>
                <option value="C" <?php if ($option== 'C')
                {
                    echo(
$s);
                } 
?> >Choice C
                </option>
            </select>
        </fieldset>
        <br>
        <input type="submit" name="submit" value="Submit">
    </form>
</div>

<?php
    
// show results
    
echo("Choice: $option");
    echo(
'<pre>');
    
print_r($_POST);
    echo(
'</pre>');
    
    include(
'includes/footer.php');
?>