I want to assign javascript variable value to php variable. I am new to this and not able to achieve the same. Below is my code:
<script type="text/javascript">
function foo(sampleValue)
{
var table = document.getElementById('mytable');
var answer = table.rows[sampleValue].cells[1].innerText;
alert (answer);
window.location.href = "show.php?w1=" + answer;
}
</script>
<?php
if(isset($_POST['shwData']))
{
if(isset($_GET['w1']))
{
echo "this is it";
}
}
?>