Arc Forum | More complicated, but scales better to more complex problems and it is back-butt...

1 point by bonzinip 6494 days ago | link | parent

More complicated, but scales better to more complex problems and it is back-button friendly.

 <?php
 $step = isset ($_POST['step']) ? $_POST['step'] : 0;
 if ($step == 0)
 $_POST = array();
 $_POST['step'] = ($step + 1) % 3;
 echo '<form method="post">';
 foreach ($_POST as $k => $v)
 echo '<input type="hidden" name="' . htmlspecialchars ($k) . '"
 value="' . htmlspecialchars (stripslashes ($v)) . '" />';
 
 echo '<p>';
 switch ($step)
 {
 case 0:
 echo '<input type="text" name="simon-sez">';
 break;
 case 1:
 echo 'Simon sez...';
 break;
 case 2:
 echo htmlspecialchars (stripslashes ($_POST['simon-sez']));
 break;
 }
 echo '</p>';
 echo '<input type="submit" value="Go on" />';
 echo '</form>';
 ?>



AltStyle によって変換されたページ (->オリジナル) /