news_manager.php

//LOAD KATEGORI
			$result = mysql_query("SELECT * FROM kategori_berita ORDER BY kategori ASC") or die(mysql_error());
		?>
		Pilih Kategori Terlebih dahulu 	<select name="kategori" onchange="submit();">
										<?php
										if (empty($_REQUEST['kategori'])) echo '<option value="" selected="selected">--Kategori--</option>';
										while ($data=mysql_fetch_array($result)){
											?><option <?php if ($_REQUEST['kategori'] == $data['id']) echo 'selected="selected"' ?> value="<?php echo $data['id']; ?>"><?php echo $data['kategori']; ?></option>
										<?php
											
										}
										?>							
									</select><br/>

The above code suppose to show me list of kategory in the drop down box.

Yet this is what's appears:

Pilih Kategori Terlebih dahulu --Kategori--

When I scroll down --Kategori-- it does not show me anything else, while I already will in the column field through phpmyadmin.

Any clue?

Recommended Answers

All 3 Replies

Check out the spelling of kategori and id'.It should be match with table field name.

The table name: kategori_berita and the fields name: id (underlined) and kategori.

Check the HTML output of your page, are your database values in there ? Then you have a typo somewhere in your file (unclosed tag perhaps).

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.