When this script is called for 1st time, var variable is not initialized (Value: ).
In the second pass (submit) it is.
[code=php]
<html>
<head>
<title>TITLE</title>
</head>
<body>
<script language=”Javascript1.2″>
<!–//
document.write(‘<form method=POST action =”<? echo $PHP_SELF; ?>”>’);
document.write(‘<input type=hidden name=var value=29>’);
//–>
</script>
<input type=submit value=Get><p>
</form>
<?
echo “Value: $var”;
?>
</body>
</html>
It’s a bit confusing, because during the second pass the same JS code is performed, that is, document.write function performs the same writing of html code, before the php part is executed.
What’s the difference btw the 1st and 2nd pass?
Thanks