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 post
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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...