Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more - View Single Post - Displaying value from a Drop Down Menu ( form ) using php ?
View Single Post
Old 06-18-2009, 01:06 PM   #1 (permalink)
ranga227
Junior Member
 
Join Date: Jun 2009
Posts: 3
Default Displaying value from a Drop Down Menu ( form ) using php ?

Hi,

I want to take the value selected from a drop down menu I have and then add the value too somewhere else on the page. The reason for this is so eventually I can hide this value and add it into a URL ( it's a long story..).

So anyway this is my code so far:

Code:
<form id="countries_select" name="countries_select" method="post" action="$_SERVER['PHP_SELF']">
  <select name="countries" id="countries" onchange="">
    <option value="US">United States</option>
    <option value="GB" selected="selected">United Kingdom</option>
    <option value="ES">Spain</option>
  </select>
  <label>
    country_selected:
    <?php $country = $_POST[''];
    echo  $country;?>
    
     
  </label>
</form>
So basically I just need to know how to get the value from the drop down into the variable "$country"

Thanks
ranga227 is offline   Reply With Quote
Sponsored Links