Jump to content
Larry Ullman's Book Forums

Single select option to multiple choice select option


Recommended Posts

Please, I want to convert this single select option to multiple choice select options. i,e to select more than one option in the select dropdown
<?php

                          $get_sizes = "select * from sizes";
                          $run_sizes = mysqli_query($con,$get_sizes);
                          
                          while ($row_sizes=mysqli_fetch_array($run_sizes)){
                              
                              $size_id = $row_sizes['size_id'];
                              $size_name = $row_sizes['size'];
                              
                              echo "
                              
                              <option value='$size_id'> $size_name </option>
                              
                              ";
                              
                          }
                          
                          ?>
                          
                      </select><!-- form-control Finish -->
Link to comment
Share on other sites

okay thanks but  I am trying to use foreach loop where I want to enter the $_Post['size'] into database but don't know how to assign the $i variable below back to the $size variable

if(isset($_POST[‘submit’])){

$size = $_POST[‘size’];

foreach ($size as $i)
{
echo ("$i<br>");
 

}
$insert_product = "insert into products (size) values (’$size’)

Link to comment
Share on other sites

 Share

×
×
  • Create New...