please help me. this my trouble
Notice: Undefined index: p in C:\wamp\www\index.php on line 7
and soure

<?php
session_start ();
include ("function.php");
$title = "Trang chủ";
include ("header.php");

$p_now = intval($_GET ['p']);
$total = mysql_result ( mysql_query ( "SELECT COUNT(id) FROM baiviet WHERE kieu='post'" ), 0 );
$numofpages = $total / $pp;

if ($p_now<=0) {
	$page = 1;
} else {
	if($p_now <= ceil($numofpages))
		$page = $p_now;
	else
		$page = 1;
}

$limitvalue = $page * $pp - ($pp);
$query = "SELECT * FROM baiviet WHERE kieu='post'  ORDER BY id DESC LIMIT $limitvalue, $pp ";

$result = mysql_query ( $query );
while ( $row = mysql_fetch_array ( $result ) ) {
	?>
<br />
<div class="check"><a href="baiviet.php?id=<?=$row ['id'];?>"><?=$row ['tieude'];?> :</a></div>
<div><a href="upload/image/<?=$row ['hinhanh'];?>" class="preview"
	title="<?=$row ['tieude'];?>"><img
	src="upload/image/thumbs/<?=$row ['hinhanh'];?>" border="0"
	align="left" /></a>
<p><b>Lượt xem :</b> <?=$row ['view'];?><br />
<b>Ngày gửi :</b> <?=date ( 'd/m/Y \l\ú\c H:i:s', $row ['thoigian'] );?><br />
<b>Chuyên mục :</b> <a
	href="chuyenmuc.php?id=<?=$row ['catID'];?>"><?=getparentname ( $row ['catID'] );?></a><br />
<b>Tag :</b> <?=$row ['tag'];?><br />


<p><?=$row ['gioithieu'];?><a href="baiviet.php?id=<?=$row ['id'];?>">[ Chi tiết ...]</a></p>

</div>
<div class="clear"></div>


<?php
}
echo "<div class=\"center\">";
page_div ( "?p=%d_pg", "10", ceil ( $numofpages ), $page );
echo "</div>";
mysql_close ();
include ("footer.php")?>

==========================================
Notice: Undefined index: username in C:\wamp\www\header.php on line 37
this code

<?php
if (checkadmin ( $_SESSION ['username'] ) && $_GET ['page'] == 'addpost' || $_GET ['page'] == 'editpost') {
	?>

Replace your line 7 with

$p_now=0;
if(isset($_GET['p']) && !empty($_GET['p'])
     $p_now = intval($_GET ['p']);

Use code tags to post your code

Replace your line 7 with

$p_now=0;
if(isset($_GET['p']) && !empty($_GET['p'])
     $p_now = intval($_GET ['p']);

Use code tags to post your code

thanhks :*

Mark this thread as solved if your problem solved

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.