rammy
Jan 4th, 2002, 04:51 AM
Hi,
Is it possible to use Javascript variables in PHP code? I need to be able to assign the values of javascript variables to PHP variables.
I am able to display the values using the alert statement. But how can these values be assigned to PHP variables?
Thanx a lot.
Here's my sample code:
<html>
<head>
<title>Test page</title>
<Script language="javascript">
var a;
var a1 = new Array();
function testfn()
{
var i;
a='abc';
for (i=0;i<=4;i++)
a1[i]=i;
}
</script>
</head>
<body>
<?php
echo "<script language='javascript'>";
echo "testfn();";
echo "alert(a);";
echo "alert(a1[2]);";
echo "</script>";
?>
</body>
</html>
Is it possible for me to assign the values of "a" and the array "a1" to PHP variables?? Thanx again.
Is it possible to use Javascript variables in PHP code? I need to be able to assign the values of javascript variables to PHP variables.
I am able to display the values using the alert statement. But how can these values be assigned to PHP variables?
Thanx a lot.
Here's my sample code:
<html>
<head>
<title>Test page</title>
<Script language="javascript">
var a;
var a1 = new Array();
function testfn()
{
var i;
a='abc';
for (i=0;i<=4;i++)
a1[i]=i;
}
</script>
</head>
<body>
<?php
echo "<script language='javascript'>";
echo "testfn();";
echo "alert(a);";
echo "alert(a1[2]);";
echo "</script>";
?>
</body>
</html>
Is it possible for me to assign the values of "a" and the array "a1" to PHP variables?? Thanx again.