All pastes #402215 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-03-19 20:04 UTC
rendered paste body
<html>
<head>
</head>
<body>
  <?php
	$size = "3";
	$submit = isset($_POST['command']);
	$step = $_POST['step'];

	echo '<form action="<?php $_SERVER['PHP_SELF'] ?>" method="post">';

	if($step == 1) {
		echo '<input type="hidden" name="step" value="1" />
  		Size: <input type="text" name="size" value="'.$size.'" size="6" maxlength="40"/>&nbsp;
  		<input type="submit" name="command" value="go"/><br />';
	}

	if($step == 2) {
		echo '<input type="hidden" name="step" value="2" />
	      	echo '<input type="hidden" name="size" value="3" />';
		echo '<select name="v0">';
		for($i=0; i < sizeof($size); ++$i) {
			echo '<option value="'.$i.'">unset</option>';
		}
		echo '</select>';	
		echo '<input type="submit" name="command" value="go"/><br />';
	}

	if($step == 3) {
		echo '<h1>And the answer is... 6</h1>';	
	}
		
		

	if(submit) {
		if($step == 1) {
			$size = $_POST['size'];
		
			if($size == "" || !ctype_digit($size) || $size > 12 || $size < 1) {print "size must be an integer between 1 and 12 (inclusive)"; }
			else {
				$step = 2;
			}
		}

	}
  	
	echo '</form>';	
	
  ?>
</body>
</html>