/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php //page titles / page number 'Page Number 1' => '01', 'Page Number 2' => '02', 'Page Number 3' => '03' ); //get current page //write pages foreach($titles as $v => $k) { $h = ($k == $page) ? " style='background:yellow;'" : ''; echo "<a href='?page=$k'$h>$v</a><br />\n"; } // If page is '?page=02', will print... // // <a href='?page=01'>Page Number 1</a> // <a href='?page=02' style='background:yellow;'>Page Number 2</a> // <a href='?page=03'>Page Number 3</a> ?>