Jump to content

Make Selected Values Appear as List


I-AM-OBODO

Recommended Posts

Hi all.

 

how can i make the values show like a list. I tried html line break "<br>" and php \n but all to no avail. It just show all the values in one straigth line.

 

example of what i want is for the values to appear like this:

 

1234567890

0987654345

4567890675

 

instead of :

 

1234567890 0987654345 4567890675

 

Thanks

 
<form data-abide method="post" action="">
<div>
<select name="">
  <option value="name">
  <?php
$stmt = $pdo->query("SELECT acct_num FROM table order by id desc");
while ( $row = $stmt->fetch(PDO::FETCH_ASSOC) ) {
echo $row['acct_num'];
}
 
  ?>
</option>
</select>
</div>
<div>
    <label>New Password <small>required</small></label>
    <input type="password" name="password" id="password" required>
    <small class="error">New password is required and must be a string.</small>
</div>
<div>
    <label>Confirm New Password <small>required</small></label>
    <input type="password" name="password2" id="password2" required>
    <small class="error">Password must match.</small>
</div>
 

<input name="submit" type="submit" class="button small" value="Change Password">
</form>
Link to comment
https://forums.phpfreaks.com/topic/292433-make-selected-values-appear-as-list/
Share on other sites

Wow! after much playing around. Got it

 

 

           
<?php
            $stmt = $pdo->query("SELECT acct_num FROM table ORDER BY id DESC");
            while($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
                $acct_num = $row['acct_num'];
                echo "<option>
                    $acct_num
                </option>";
            }
?>

 

Thanks all

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.