PHP list box


 

PHP list box

In this part of the tutorial we will learn how to use the list box in the PHP form.And we will also see the example related to the list box.

In this part of the tutorial we will learn how to use the list box in the PHP form.And we will also see the example related to the list box.
  • The PHP List box is used in the form.
  • It takes input values from the user.
  • The PHP List box contains multiple values at a time.

PHP List Box Example

<?php
    
if(isset($_GET['hobbie']))
       echo
"My hobbie is ".$_GET['hobbie'];
     else
{?>

     Select your hobbie <form action='<?php echo $_SERVER['PHP_SELF'];?>'>
     <
select name='hobbie' size="4">
     <
option value='music'>music</option>
     <
option value='reading'>reading</option>
     <
option value='swimming'>swimming</option>
     </
select>
     <
input type="submit">
     </
form>
<?php
}?>

 

output

My hobbie is music

Ads