0

<?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...

4
Contributors
4
Replies
5
Views
5 Years
Discussion Span
Last Post by rajesh1158
1

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

Votes + Comments
I am not getting please elabrate
0

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

That is a GET variable not POST

$noticeid=$_GET['nid'];
0

$_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'.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.