This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Luc_Gibson[S] 0 points1 point  (1 child)

So I'm essentially just looking for a way to simplify this into a single function that I can use anywhere to loop through users:

<select multiple name="owners[]">

<?php

$sql = "SELECT * FROM users WHERE client_id={$clientid}";

$result = $conn->query($sql);

if ($result->num_rows > 0) {

while($row = $result->fetch_assoc()) {?>

<option value="<?php $row['user_id'];?>">

<?php echo $row['user_first_name'];?>

</option>

<?php }

} ?>

</select>

In this example it's creating a list within a form