I don't think a variable reference such as $POST["$submit"] would work and here's why. Double quotes use interpolation and since there is only one thing in them (a variable) they don't matter. Now having something like $POST[$submit] would evaluate $submit and use it as the index into $_POST instead of using the string "submit" as the index. Since submit will evalute to "Click here to show $a" (I don't even want to think about whether the parser would try to substitute something in place of $a), you will be looking for a POST variable called "Click here to show $a" which doesn't exist. The array is indexed by name, not value.
The rest of your logic, however, is correct. Since there is no form variable "a" all references to it in the script will be the empty string. Here is more of what you'd want, hamid30:
<html>
<body>
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST" && $_POST["submit"]) {
echo $_POST["a"];
}
else {
$a = "this is a test";
?>
<form method="post" action="<?php echo $_SERVER["PHP_SELF"]; ?>">
<input type="text" name="a" value="<?php echo $a; ?>">
<input type="submit" name="submit" value="Click here to show $a">
</form>
<?php
}
?>
</body>
</html>