<?php
$noticeid=$_POST['nid'];
$uname=$_SESSION['user'];
include('db_connect.php');
$sql="SELECT * FROM notice WHERE nid='$noticeid'";
$data=mysql_query($sql);
$d = mysql_fetch_assoc($data);
$notice=$d['notice'];
echo $notice;
?>

When I am retrieving data its saying :
Notice: Undefined index: nid in C:\xampp\htdocs\sm\viewnotice.php on line 53

Wheres i am passing the varibale from previous page and its reflecting in browser too.

<a href='viewnotice.php?nid=$nid'>$ntitle</a>

Please suggest...

You should write some litle more of your code... like, the code in viewnotice.php for example..

commented: I am not getting please elabrate +1

Can anyone help me am not able to solve this issue ???

<a href='viewnotice.php?nid=$nid'>$ntitle</a>

That is a GET variable not POST

$noticeid=$_GET['nid'];

$_POST should be used to retrieve data only when data is submitted through forms. Since you are using a link, data is passed in the URL. so you have to use $_GET to retrieve 'nid'.

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.