Is this possible:

<script language='Javascript'>
ans="XXX"
<?php
$phpans=ans;
setcookie("Test",$phpans);
?>
</script>

Thanks for any help.

Ivan Gepner
gepner@monmouth.edu

    Basic concepts:

    JAVASCRIPT is executed by the client, the Web browser.

    PHP is executed by the Web server before anything is sent to the client.

    If something happens in Javascript and you want PHP to do something with it, you have to submit a GET or POST request for a new page, passing the value appropriately.

      9 days later

      ...if you used javascript to pass its var to populate a text input box on your page, could you not grab the variable from that?

        Write a Reply...