i have one folder,in that i have many files and i have four buttons also,the buttons are first,next,previous,last. when i click on first button i want to get first file content and it should display which file currently working on.when i click on next button i want to get next file content,when i click on previous button want to get the previous file content,when i click on last button i want to get the last file content.
$next_slide=$text+"1";
echo $next_slide;
$a_str = array($_POST["content"]);
$contents = implode(PHP_EOL, $a_str);
$contents .= PHP_EOL . PHP_EOL;
$get_content=file_get_contents($foldername.'/'.$next_slide."-html",$contents);
when i click on first getting first file content,passing the 1 as to php fie and adding +1 for get the next file content,but not get the second file content please help me how to do it?
Try following and -html is not a valid extension
$handler = fopen($foldername.'/'.$next_slide.'.html','r');
$get_content = fread($handler);
You have to save customer choice:
$choice = 0;
if(isset($_SESSION['actual'])){
$choice = $_SESSION['actual']; or COOKIE as you want.
}
if($_GET['next']){
$choice++;
}
elseif($_GET['previous']){
$choice--;
}
elseif($_GET['first']){
$choice = 'first';
}
elseif($_GET['last']){
$choice = 'last';
}
$_SESSION['actual'] = $choice;
$get_content=file_get_contents($foldername.'/'. $choice ."-html",$contents);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.