Jump to content

Make Selected Values Appear as List


I-AM-OBODO
Go to solution Solved by 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>
Edited by Mr-Chidi
Link to comment
Share on other sites

  • Solution

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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.

×
×
  • 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.