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.

 
 

Share on Google+Share on Google+

PHP list box

Ads

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

Advertisements

Ads

Posted on: October 31, 2009 If you enjoyed this post then why not add us on Google+? Add us to your Circles