if my question appears to be silly but I ran out of explanations. I'm trying to set up a page with some news on it. I have the database with such attributes like News_id, news_header, news body etc.
I have 2 pages first page gives a list of the brief descriptions of the news with the button which allows user to read some more of a particular news on it. If clicked it passes a corresponding news_id value to the page 2 which fetches News_Id Value, queries corresponding values from database value and outputs the content.
The problem is that no mater which button in the list of page 1 I click to see news, the page 2 always receives the news_id value of the news which is *first in the lin*e. here are the codes
PAGE ONE (the list)
<form name='NewsLineSelection' method='post' action='news.php'>
<?php
$News_Query = "Select * from news order by Date_Posted Desc;";
$GetNews = mysql_query( $News_Query, $IVE_Connection ) or die("ERROR: ".mysql_error());
while ( $News_Database = mysql_fetch_array( $GetNews ) ){
?>
<tr><td ><?php echo $News_Database[1]; ?></td>//header
<tr><td ><?php echo $News_Database[2]; ?></td>//news body
...etc
<tr><td class="maintext">
<input type='hidden' name='NewsToRead' value='<?php echo $News_Database[0]; ?>'>//News_ID is here
<input type='submit' name='AddNews' value='Read More...' >
</td></tr>
}//end of the loop
Page 2 (with info details)
$News_id = addslashes($_POST['NewsToRead']);
$News_Query = "Select * from news where news_id = ".$News_id.";";
$GetNews = mysql_query( $News_Query, $Connection ) or die("ERROR: ".mysql_error());
$News_Database = mysql_fetch_row( $GetNews );
//Then output the query's content
It looks perfect on paper. But I really can't understand why if there are 10 news in the list of page 1 for instance, no matter which button I click the value of $News_id in PAGE 2 will be always the id of the first news in the list on the page 1.
May be I don't see something. it suppose to work ok, but it doesn't.
Thanks for any kind of help or suggestions.