Answers for "select multiple php"

PHP
1

select2 multiple in php

// In your HTML:
<form method="post">
  <select class="select2" name="listbox[]" multiple="multiple">
    <option value="One">One</option>
    <option value="Two">Two</option>
    <option value="Three">Three</option>
    <option value="Four">Four</option>
  </select>
  <input type="submit" name="btn" value="Get the Records">
</form>

// In your Javascript (external .js resource or <script> tag):
$(document).ready(function() {
  $('.select2').select2();
});

// In your PHP

<?php

  if (isset($_POST['btn']) && $_SERVER['REQUET_METHOD']==="POST") {
    $items = $_POST['listbox'];
    foreach ($items as $item) {
      // Run SQL Query or do any other action
      echo $item.'<br>';
    }
  }
  
?>
Posted by: Guest on August-23-2021
0

select multiple php

<form action="ResultsDulith.php" id="intermediate" name="inputMachine[]" multiple="multiple" method="post">
    <select id="selectDuration" name="selectDuration[]" multiple="multiple"> 
        <option value="1 WEEK" >Last 1 Week</option>
        <option value="2 WEEK" >Last 2 Week </option>
        <option value="3 WEEK" >Last 3 Week</option>
         <option value="4 WEEK" >Last 4 Week</option>
          <option value="5 WEEK" >Last 5 Week</option>
           <option value="6 WEEK" >Last 6 Week</option>
    </select>
     <input type="submit"/> 
</form>
Posted by: Guest on June-14-2021

Browse Popular Code Answers by Language