These things are best done with Javascript but, since your question is tagged PHP, I’ve written the following code:
<?php
$primes = array(2, 3, 5, 7, 11, 13, 17, 19, 23, 29,
31, 37, 41, 43, 47, 53, 59, 61, 67, 71,
73, 79, 83, 89, 97, 101, 103, 107, 109, 113,
127, 131, 137, 139, 149, 151, 157, 163, 167, 173);
// Add as many primes as you wish to the array
$num = array_key_exists("hid", $_POST) ? $_POST["hid"]+1 : 0;
?>
<html>
<head>
<!-- Put your meta tags, title, Javascript and CSS here -->
</head>
<body>
<form method="POST">
<h2><?php print($primes[$num]); ?></h2>
<?php
if(sizeof($primes)-$num > 1){
?>
<input type="hidden" name="hid" value="<?php print($num); ?>"/>
<input type="submit" name="sub" value="Next Prime"/>
<?php
}
else{
?>
<input type="submit" name="sub" value="Next Prime" disabled/>
<?php
}
?>
</form>
</body>
</html>