<?php
if(isset($_GET["step2"])){
//User has entered step2
echo "Thank you";
}else{
//User is on first step
if(isset($_POST["button"])){
//Button has been pressed
if(isset($_POST["field1"]) && isset($_POST["field2"])) {
//Fields are filled out.. do stuff
header("Location: main.php?step2");
}else{
echo "Please fill in all fields correctly";
}
}
?>
<form method="post">
<input type="text" name="field1" />
<input type="text" name="field2" />
<input type="submit" name="button" value="Do it" />
</form>
<?php
}