I have a form that includes a multiple select box populated with therapist names pulled from a database table.
This is my code:
<div class="form-group col-sm-6 col-md-4">
    <label for="therapist"><strong>Senior Practitional / SP: </strong></label>                                                
    <select name="therapist[]" id="therapist" multiple="multiple" class="form-control selectpicker" multiple data-live-search="true" data-live-search-placeholder="Search" data-actions-box="true" data-parsley-trigger="change" required-no>
        <?php
        require_once('include/database.php');
        // read current record's data
        try {
            // prepare select query
            $getUser = "select firstname, lastname, profession from user WHERE user_type = 'therapist'";
            $stmt    = $con->prepare($getUser);
            // execute our query
            $stmt->execute();
            // store retrieved row to a variable
            while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
                // values to fill up our form
                $firstname  = $row['firstname'];
                $lastname   = $row['lastname'];
                $profession = $row['profession'];
                echo '<option id="firstname_' . $row['id'] . '" value="' . $row['id'] . '">' . $row['firstname'] . ' ' . $row['lastname'] . ' - ' . $row['profession'] . '</option> ';
            }
        }
        // show error
        catch (PDOException $exception) {
            die('ERROR: ' . $exception->getMessage());
        }
        ?>
    </select>                                           
</div> 
But the problem I am facing is that if I select multiple therapists I only get an integer of 1 in the result table.
** Second Issue **
The other issue I have is, I have a time_of_visit form field which is a multiple-select:
<?php $time_of_visit = $time_of_visit; ?>                       
<div class="form-group col-md-4">
    <label for="tov"><strong>Time of Visit: </strong></label>
    <select name="tov[]" class="form-control selectpicker" value='<?php echo $time_of_visit; ?>' multiple
        data-live-search="true" data-live-search-placeholder="Search" data-actions-box="true" data-parsley-trigger="change" required-no>
        <!-- <option selected>Select Visit Time...</option> -->
        <option name="tov[]" <?php if (isset($time_of_visit) && $time_of_visit == "am") echo "selected"; ?> value="am" selected>Am</option>
        <option name="tov[]" <?php if (isset($time_of_visit) && $time_of_visit == "lunch") echo "selected"; ?> value="lunch" selected>Lunch</option>
        <option name="tov[]" <?php if (isset($time_of_visit) && $time_of_visit == "pm") echo "selected"; ?> value="pm">Pm</option>
        <option name="tov[]" <?php if (isset($time_of_visit) && $time_of_visit == "am_pm") echo "selected"; ?> value="am_pm">Am or Pm</option>
        <option name="tov[]" <?php if (isset($time_of_visit) && $time_of_visit == "pm_care") echo "selected"; ?> value="pm_care">Pm Care</option>                                                                                                   
        <option name="tov[]" <?php if (isset($time_of_visit) && $time_of_visit == "single") echo "selected"; ?> value="5pm" selected>>5pm</option>
    </select>                                           
</div>
When the form is submitted I am getting time_of_visit cannot be null. I am guessing that I have probably set it to Yes NULL in the database which I can change later, but I can't seem to keep the selected option whether the query fails or is successful.
 
     
    