Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

php listen to select event

<html>
<head>
</head>
<body>
    <?php
        function OnSelectionChange() {
            echo("OK IT WORKS");
        }    
    ?>
<section>
    <select onchange="OnSelectionChange()">
        <option value='' disabled selected>Assign Driver</option>
        <option value='4353'>Steve Jobs</option>
        <option value='3333'>Ian Wright</option>
        <option value='66666'>Mark James</option>
    </select>
</section>    
      
 // NEW LINE     
  <form method="POST" action="">
      Select Your Country 
      <select name="country" onchange="this.form.submit()">
          <option value="" disabled selected>--select--</option>
          <option value="india">India</option>
          <option value="us">Us</option>
          <option value="europe">Europe</option>
      </select>
  </form>
<?php
   if(isset($_POST["country"])){
       $country=$_POST["country"];
       echo "select country is => ".$country;
   }
?>
</body>
</html>
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #php #listen #select #event
ADD COMMENT
Topic
Name
8+4 =