Couldn't you write a function as well?
You can put the function at the top of your script, below the opening php tag.
PHP Code:
function checkValues($step, $agree, $page);
{
if($step == 1 && $agree == "yes")
{
header('Location: ?step=$page');
}
else
{
header('Location: ?step=$page&warn=yes');
}
}
Where you're using the if/else or switch method you can replace it with
PHP Code:
checkValues($_POST['step1'], $_POST['agree'], $_POST['page'])
In your first form add the HTML code below the opening form tag.
HTML Code:
<input type="hidden" name="page" value="1" />
Add the same HTML code to all the other forms but change "value="1"" to "value="2"" and value="3"".