My prog will notice this:
Notice: Undefined variable: newsid in
D:\LITRAS\nawal\read_more.php on line 5
if I click 'Read More' from index.php. But if i put this,
$newsid = $_POST['newsid'];
Notice: Undefined index: newsid in
D:\LITRAS\nawal\read_more.php on line 5 will be out.
I'll attached my file too
File1:index.php
<title>News----By: maaking.com</title>
<?php
// load the configuration file.
include("config.php");
//load all news from the database and then OREDER them by newsid
//you will notice that newlly added news will appeare first.
//also you can OREDER by (dtime) instaed of (news id)
$result = mysql_query("SELECT * FROM news ORDER BY newsid DESC",$connect);
//lets make a loop and get all news from the database
while($myrow = mysql_fetch_array($result))
{//begin of loop
//now print the results:
echo "<b>Title: ";
echo $myrow['title'];
echo "</b><br>On: <i>";
echo $myrow['dtime'];
echo "</i><hr align=left width=160>";
echo $myrow['text1'];
// Now print the options to (Read,Edit & Delete the news)
echo "<br><a href=\"read_more.php?newsid=$myrow[newsid]\">Read More...</a>
|| <a href=\"edit_news.php?newsid=$myrow[newsid]\">Edit</a>
|| <a href=\"delete_news.php?newsid=$myrow[newsid]\">Delete</a><br><hr>";
}//end of loop
?>
<br><br>
<a href=index.php>Home</a> <a href=add_news.php>Add News</a>
File2:readmore.php
<title>News Details...</title>
<?php
include("config.php");
$result = mysql_query("SELECT * FROM news WHERE newsid='$newsid' ",$connect); //THIS IS LINE 5
while($myrow = mysql_fetch_assoc($result))
{
echo "<b>";
echo $myrow['title'];
echo "</b><br>On: <i>";
echo $myrow['dtime'];
echo "</i><hr>";
echo $myrow['text1'];
echo " ";
echo $myrow['text2'];
echo "<br><br><a href=\"javascript:self.history.back();\"><-- Go Back</a>";
}
?>
'Read More' 'Read More' Read More.. Read More.. $newsid = $_POST['newsid']; //THIS IS LINE 5 //THIS IS LINE 5 //THIS IS LINE 5