I have just started learning coding and PHP so I have been looking at practising what I have learnt so far however am unsure how efficient or inefficient my coding is. I would appreciate your comments on the loop below. It is a simple loop and have commented out a simpler example of it. I would appreciate any advise on how I can better my coding.
//Initialize page
$startpage = isset($_POST['page']) ? $_POST['page'] : 1;
$endpage = 11;
//Loop through the start and end of the page
while($startpage < $endpage) {
if(isset($_POST['submit'])) {
$startpage=$startpage+1;
}
if($startpage < $endpage) {
break;
}
}
//Alternative option
// if(isset($_POST['submit'])) {
// if($startpage < $endpage) {
// $startpage = $startpage + 1;
// }
// }
EDIT
The reason I am performing a $_POST check is because I only want have the user move from one page to the next after the hit submit.