but lets talk from the begin. I am creating website similar like wordpres blog index page (can't show picture bescause dont have enough reputation). And then I click read more link in the intro article I want save that article id from the database to php sesions. Here is the code.
while($row = mysqli_fetch_array($result))
{
echo '<div class="img">
<img src="img/smiley.gif" alt="Smiley face" width="250" height="250">
</div>';
echo "<h2>".$row['Name'] . "</h2> " ;
$string = strip_tags($row['Content']);
if (strlen($string) > 500) {
$stringCut = substr($string, 0, 500);
$string = substr($stringCut, 0, strrpos($stringCut, ' ')).'... <a href="post.php?link=1">Read more</a>';
}
//echo $string;
if(isset($_GET['link']) /*you can validate the link here*/){
$_SESSION['link']= true;
}
echo $string;
echo "<br>";
echo '<div class="content dashboard clearfix"></div>';
echo '<hr>';
}
mysqli_close($con);
?>
So I have 3 intro articles in index.php file and I whant read one, so I press READ MORE (then I should write article id to session) and go to other page, were I think I should get articles id from session. I am tryyng do it with
if(isset($_GET['link']) ){ /*you can validate the link here*/
$_SESSION['link']= true;
}
But it always write number 5 the last ID from database, so I think I should use maybe AJAX, javascript?? Maybe some one can give me the example? Thank you.