jquery - Php "continue" on click -


i have values in array. first, want show first 2 values of array in view , next want show remaining values after button click action incrementing array index 1. example: 1 click shows 3rd value click shows 4th .

how can achieve ??

$array=[1,2,3,4,5,6,7,8,9]; foreach($array $a) {  if($a>2) continue; echo $a.'<br/>'; } 

for first time want view like

1 2 

and after once button clicked need show 3 4 5 . . .

that not how php works.

a php script runned on server build web page. once have it, need rebuild page, according new parameters (recived or post), asking server again.

it that:

<?php      $array=array(1,2,3,4,5,6,7,8,9); //that how declare array in php      if(empty($_get["count"])){ //it's first time on page, show first 2 elements         echo $array[0] . ' ' . $array[1];         echo '<br><a href="page.php?count=1">next</a>'; //send same page, send count     }      else{ //it's not first time on page, keep track of how many times link clicked         $count = $_get["count"];         echo $array[$count] . ' ' . $array[$count+1];         $count++;         echo '<br><a href="page.php?count=' . $count . '">next</a>';     }  ?> 

but should not doing stuff this. if want interact user, changing page dinamically after it's contructed need javascript.


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -