Home Tutorial Php List PHP list box

 
 

PHP list box
Posted on: October 31, 2009 at 12:00 AM
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

Related Tags for PHP list box:


Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.