Ok, so this is cool. On my site, I learned how to create a simplified "wall" like facebook has... sort of. It's great for me to have done that because I am self taught with all of this. There is a problem, however. My <option> is not displaying the names correctly. It should display each name listed in the database separately, instead it is showing displaying them as a runon sentence. I don't understand why the <br> command isn't working. Here is the php:

<?php
$query=mysqli_query($rcon,"SELECT userid FROM registration");
while ($row=mysqli_fetch_array($query)){
echo $row['userid'] . '<br>';}
?>

and here is the other code

<?php

include('php/wall.php');

?>
<form name="response" action="messages/enterblog.php" method="POST">
To:<select name="respondto">
<option name="to"><?php require('connect/registerdb.php'); include('messages/list.php');?></option>
</select>
Message:<input type="text" name="respond">
<input type="submit">
</form>
</div>

Here is what is displayed.
rountest

as opposed to
roun
test

You could try something like this.. something pretty easy without function and no object..

$option_block = ''; //this actually prevent the error just in case it is zero results.

$query=mysqli_query($rcon,"SELECT userid FROM registration");
    while ($row=mysqli_fetch_array($query)){

    $option_block .= '<option name="to">'.$row['userid'].'</option>';
}

then on your page witht he form, you can do like this.. I am guessing on the file structure here, because I don't where the actual query result is coming from.

require_once('connect/registerdb.php');
require_once('messages/list.php');

To:<select name="respondto">
        <?php echo $option_block;?>
</select>

that's pretty much it...good luck to you.

No, still showed rountest instead of
roun
test

Got it. Here is the final php code. I needed to open and close the <option> tags in the loop. Thanks for the idea, as you can see I incorporated most of what you did in the final code.

<?php require('connect/registerdb.php');

echo '<select name="respondto">';

$query=mysqli_query($rcon,"SELECT userid FROM registration");
while ($row=mysqli_fetch_array($query)){

echo '<option name="to">' . $row['userid'] . '</option>';}
echo '</select>';
?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.