Hello. I have this code..

<input type="hidden" id='sessio' value=<?php echo $_SESSION['iden']; ?>>
  <script type="text/javascript">
          var x = document.getElementById('sessio').value;
          window.location="index.php?link=2&var=" + x;
  </script>

It works perfectly fine in IE but it won't work in firefox. Both link and var does not appear in the URL when I get to index.php.
Can anyone explain why? How is it not working in firefox?
Please tell me a way to make this work in firefox.

Whilliam,

It may be as simple as putting the value in single or double quotes:

<input type="hidden" id='sessio' value="<?php echo $_SESSION['iden']; ?>">
<script type="text/javascript">
    var x = document.getElementById('sessio').value;
    window.location="index.php?link=2&var=" + x;
</script>

Alternatively, you can write $_SESSION directly into javascript without needing to retrieve it from the DOM.

<script type="text/javascript">
    var x = <?php echo $_SESSION['iden']; ?>;
</script>

It is then available to do anything you want in javascript.

Airshow

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.