-1

I am attempting to create a drop-down menu that links to user profile pages and includes user images next to it. I am a bit new to PHP so bear with me if this is a simple question. Here is the code I've created:

 function dropdown() {



    $query = "SELECT * FROM usersbadges";
    $result = mysql_query($query);


    while($row = mysql_fetch_array($result)){
        $name=$row['name'];
        $image=$row['image'];

    }
    mysql_close(); 
}   

$options.=<option value=\$name\>.$image </option>;
<select name=name>
<option name=0>
print $options
</select>       

It tells me that the < brackets are unexpected but I'm at a loss as to how to put them. If those were fixed, would this code create me a drop down menu with user names accompanied by their images? I'd just like to know if I'm on the right track/what the next step is. All help is greatly appreciated

1

1 Answer 1

0

use this

  $query = "SELECT * FROM usersbadges";
    $result = mysql_query($query);


    while($row = mysql_fetch_array($result)){
        $name=$row['name'];
        $image=$row['image'];

    }
    mysql_close(); 
}   

$options.="<option value='$name'>$image </option> <select name=name> <option name=0>";
echo $options;
echo '</select>';
Sign up to request clarification or add additional context in comments.

1 Comment

tell me if this help you or not

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.