kategori_berita.php

<?php
 
 
	 include('koneksi.php');
 
	$_REQUEST['catid'] = isset($_POST['catid']) ? $_POST['catid'] : '';
 
	$result = mysql_query("SELECT * FROM kategori_berita") or die(mysql_error());
	echo '<ul>';
	while ($data=mysql_fetch_array($result)){
		if ($_REQUEST['catid']==$data['id'])
			echo '<li>'.$data['kategori'].'</li>';
		else
			echo '<li><a href="./?catid='.$data['id'].'">'.$data['kategori'].'</a><br/></li>';
	}
	echo '</ul>';
?>

</div>

I am trying to print bullet button list for each kategori:

if ($_REQUEST['catid']==$data['id'])
			echo '<li>'.$data['kategori'].'</li>';
		else
			echo '<li><a href="./?catid='.$data['id'].'">'.$data['kategori'].'</a><br/></li>';

I wonder why I do not see the bullet button, only the kategori text?

Dani AI

Generated

A missing bullet is almost always a CSS issue, not PHP. 's suggestion to add a list-style was a good diagnostic step; since reports no change after that, the most likely causes are an overriding global rule (CSS reset), a li set to display:inline, or the marker being clipped by box sizing/overflow or zero padding on the list.

A short checklist that points to the root cause:

  • Inspect the UL and LI with browser devtools and look at the computed styles for list-style-type, display, list-style-position, padding-left/margin-left, and any !important rules.
  • Search site CSS for global selectors like ul, ol { list-style: none; } or li { display: inline; }. Those will override inline styles in some cases or hide markers entirely.
  • Check ancestor containers for overflow: hidden or zero left padding; outside-positioned markers can be clipped if the container is too tight.
  • Remove the redundant <br/> inside each li (it isn't needed and can affect layout).

A scoped CSS fix that restores markers without touching global rules:

#kategori ul {
  list-style-type: disc;
  list-style-position: outside;
  padding-left: 1.2em;
}

#kategori li {
  display: list-item;
}

Use !important only as a last resort or increase selector specificity if a reset is forcing list-style: none. If the selected-category highlighting still behaves oddly, confirm server-side logic reads GET parameters (the links use query strings) rather than only POST.

Recommended Answers

All 3 Replies

Try replacing line 10 with the following:

echo '<ul style="list-style-type: circle;">';

It may be just a simple css problem which is hiding the bullets.

Well this is the whole code:

kategori_berita.php

<link href="../style.css" rel="stylesheet" type="text/css" />


<div id="kategori">
	<div class="headerStyle">
		<div style="padding:4px 0px;">Kategori Berita</div>
	</div>
    
    
 <?php
 
 
	 include('koneksi.php');
 
	$_REQUEST['catid'] = isset($_POST['catid']) ? $_POST['catid'] : '';
 
	$result = mysql_query("SELECT * FROM kategori_berita") or die(mysql_error());
	echo '<ul style="list-style-type: circle;">';
	while ($data=mysql_fetch_array($result)){
		if ($_REQUEST['catid']==$data['id'])
			echo '<li>'.$data['kategori'].'</li>';
		else
			echo '<li><a href="./?catid='.$data['id'].'">'.$data['kategori'].'</a><br/></li>';
	}
	echo '</ul>';
?>

</div>

style.css

#kategori {
	z-index: 3;
	height: 200px;
	width: 180px;
	align: left;
	position: relative;
	margin-top: 5px;
	background-color: yellow;
	font-family: Arial, Helvetica, sans-serif;
	font-size: 13px;
}

It still does not work. I just add the suggestion.

I'm not sure what else would cause the missing bullets :(

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.