Hello, I have a blogs and questions section on my site that has categories. When a user composes a question or a blog, there is a drop down menu that allows you to choose your category. When you edit either of these you have the option of changing your category via the dropdown. When you go to edit a blog,the category drop down is a standard style dropdown,and I've used <option value="1" <?php if($blog->category == "1"){echo "selected";}?> >Art and Literature</option>
to display the previously chosen category. I am picking up where another developer left off, so for the questions one he put the drop down in while loop. Being a newbie I don't know how to "echo selected" in the while loop to make it pull the previously chosen cat.Here is the loop
<select name="category">
<option value="null">Choose Category</option>
<?php
$query = "SELECT * FROM `Categories_questions` ORDER BY `CategoryName` ASC";
$request = mysql_query($query,$connection);
while($result = mysql_fetch_array($request)) {
echo "<option value='" . $result['id'] . "'>" . $result['CategoryName'] . "</option>";
}
?>
</select>