Well,
-> You do not post to any page, just to ?i=next
-> You do not retrieve $i anywhere.
Asuming you want to have the page submit to itself, and is called index.php, you need to do something like: (Only the default is set. I do not understand the logic of what you want to do for the rest:
<?php
$i = $_POST[i];
$name = $_POST['name'];
$var = $name ;
switch($i){
default:
echo"
<form method=\"POST\" action=\"index.php\">
<input type=\"hidden\" name=\"i\" value=\"next\">
Your Name : <input type=\"text\" name=\"name\">
<input type=\"submit\" value=\"submit\">
</form>";
break;
case "next":
echo"<form method=\"POST\" action=\"?i=last\">
<input type=\"submit\" value=\"submit\">
</form>";
break;
case "last":
echo "$var"; //here i want echo the last value of the $var($name value) not "null" (the first one)
break;
}
?>