Hello,

I just made my web in localhost, everything was just fine until I updates my xampp to newer version. And my web now is on a mess.

<br/>
	<div class="headerStyle">
		
	</div>
<?php
	$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 style="color:#000;">'.$data['kategori'].'</li>';
		else
			echo '<li><a class="newsCategory" href="./?catid='.$data['id'].'">'.$data['kategori'].'</a><br/></li>';
	}
	echo '</ul>';
?>

here's the code and it shows me :
Notice: Undefined index: catid in C:\Program Files\xampp\htdocs\pbd\include\kategori_berita.php on line 9

I'm still new at PHP, so please if you could teach me I would appreciate it :twisted:
thanks!

This happens when a variable isn't set properly. In this case it's your $_REQUEST variable. When using data pulled through REQUEST, POST, GET, or COOKIE you should always verify that is has a value prior to using it

i.e.

if (isset($_REQUEST['catid'])
{

  //Variable is set so do what you want with it

}
else
{

  //Variable is not set so toss error back to user

}

That being said it is generally advisable not to use $_REQUEST it is bad practice and opens a lot of security issues. Use the appropriate $_POST, $_GET, or $_COOKIE instead.

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.