0

ammm...I have this code

<table border="1" name="myTable" id="myTable">
<?php 
$nRow = $_GET['rowLength'];
$nColumn = 7;
for($i=0;$i<$nRow;$i++){
    echo "<TR>";
    for($i=0;$i<$nColumn;$i++){
        echo "<TD><INPUT TYPE='text' NAME='' VALUE=''/></TD>";
    }
    echo "</TR>";
}?>
</table>

now, I'm trying to pass js variable to php variable on the same page....
but I'm having this error: Undefined index: rowLength

...I'm using $_GET to get the variable rowLength from js...
...thank you in advance...

Edited by Kewne

2
Contributors
2
Replies
4
Views
5 Years
Discussion Span
Last Post by Kewne
0

Hi,

Can you rewrite your js function so that the only thing left is to call that function. If so, you can do it like my example below. Not a big one, but that's how you make the php call for the output of the js function. unless, you want to wrap the entire js as php variable, then the possiblility is a little bit brighter. However, passing it in the script like your script above will not do it, because PHP is parse on the server side, while js is interacting on the client side.

<?php
echo "hello! I am echoed by php <br/>";
?>

<html>
<head>
<script type="text/javascript">
function displayDate()
{
document.getElementById("out").innerHTML=Date();
}
</script>
</head>
<body>

<p>Javascript ouput delivered by php </p>
<p id="out">Echoed JS function shows here.</p>

<button type="button" onclick="<?php echo 'displayDate()';?>">Clikc Me</button>

</body>
</html> 

Edited by veedeoo: more info added

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.