Page 1 of 1

Using JavaScript variables as part of PHP

Posted: Mon Feb 17, 2003 5:01 pm
by jesso3
Hello. I am new to PHP and learning the language. I have JavaScript variables on a .htm page. I have another page that is a .php. What I like to do is use a variable like say for instance: var time; and manipulate it in my PHP file. Can anyone show me how it is done? Thanks.

Posted: Mon Feb 24, 2003 5:02 am
by Romantik
ONLY Submit form!!!

<?
if(isset($_POST["MyInp"])OR(isset($_POST["MyInp1"]))
{
echo "MyVar=".$_POST["MyInp"];
echo "<BR>";
echo "MyVar1=".$_POST["MyInp1"];
}
else
{
?>
<FORM name="name" method="POST" action="<? echo $_SERVER['PHP_SELF'];?>">
<SCRIPT>
var MyParam= 123;
document.name.MyInp.value= MyParam;
</SCRIPT>
<INPUT type="hidden" name="MyInp">
<INPUT type="text" name="MyInp1" value="10">
<INPUT type="submit">
</FORM>
<?}?>