0

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.

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by Airshow
0

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

Edited by Airshow: n/a

This topic has been dead for over six months. 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.