I want to pass the answer of a JavaScript function call to a PHP variable so that I can use else where in the PHP script.
I have the JavaScript code below
<script type="text/javascript">
    function showSelected(val)
    {
        document.getElementById('selectedResult').innerHTML =  val;
    }
</script>
I would want to save the answer of the method call in a PHP variable to be used elsewhere in the PHP script.
I tried this but it's not working
<?php
    $val = "<script type='text/javascript'>showSelected();</script>";
 ?>
Someone kindly assist.
 
    