<?php if ($x=='') { $x=0; } $y=$x+1000; while ($x<$y) { // do your stuff $x++; } echo '<html><body>You got to: '.$x.'<script>location.href="'.$HTTP_SERVER_VARS['PHP_SELF'].'?x='.$x.'"; </script></body></html>'; ?>