What is wrong with my php code?

TheNewDude

New member
I am having a problem with a couple functions I wrote.

function get_selectable_categories() {
$categories = get_all_categories();
while($category = mysql_fetch_assoc($categories)) {
echo "<input type='radio' id='category' value='" . $category['id'] . "";
echo "' />" . $category['cat_name'] . "";
}
}

function get_all_categories() {
global $connection;
$query = "SELECT *
FROM categories
WHERE visible = 1
ORDER BY cat_name ASC";
$category_set = mysql_query($query, $connection);
confirm_query($category_set);
return $category_set;
}

The get_selectable_categories() function returns something like:
<input type="radio" id="category" value="1" > Category 1

I am looking for something like:
<input type="radio" id="category" value="1" /> Category 1

How do I get the / to show up?
 
If you are trying to examine the HTML generated by the PHP code through a browser's "Show source code" feature there's a good chance that these browsers strip out the "/" on the closing angle bracket "/>". I know FireFox does this. Nevertheless, as long as the input field shows up properly I wouldn't worry about it.
 
dunnoo...maybe you should use javascripts to make that work...like AJAX. I dont see that you have a submut button or any event that would cause things to change...can you give more info on exactly what you are trying to do?
 
Back
Top