Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function selected($founders, $id, $name) {
- foreach ($founders as $founder) {
- $selected = ($founder == $id) ? ' selected' : '';
- $options[] = '<option value="'. $founder. '" '. $selected .'>'.$name.'</option>';
- }
- return implode('', $options);
- }
- ?>
- <select class="select2" name="founder_id[]" multiple="multiple">
- <?php
- $founders = explode(",",$company->founder_id);
- // print_r($founder);
- $stmt = $person->read();
- while ($row = $stmt->fetch(PDO::FETCH_ASSOC)){
- extract($row_f);
- // print_r($row);
- echo $row[$id];
- echo selected($founders, $row[$id], $row['screenname']);
- echo $row[$id]."</option>";
- }
- ?>
- </select>
- // In above $company->founder_id = 1,2,3,4
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement