Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder thindrakhya's Avatar
    Join Date
    Jun 2007
    Posts
    90
    Thanks
    8
    Thanked 0 Times in 0 Posts

    javascript in php

    hi friends ,

    i have this php code

    PHP Code:
    header("Location: merge_cart.php?oldsession=" .urlencode($cart["sessionId"])); 

    now i want to convert this code into javascript code in php echo statement

    e,g
    PHP Code:
    echo ("  windows.location(......php) "); 
    does anyone knows how to do that

    when i do iam getting an error

  • #2
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,642
    Thanks
    2
    Thanked 405 Times in 397 Posts
    Code:
    window.location('page.php?vars');

  • #3
    New Coder thindrakhya's Avatar
    Join Date
    Jun 2007
    Posts
    90
    Thanks
    8
    Thanked 0 Times in 0 Posts
    i want to know how my above link will appear in echo statement


    echo(" window.location('merge_cart.php?oldsession=" .urlencode($cart["sessionId"])');
    This is giving me error

  • #4
    New Coder
    Join Date
    Nov 2007
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    PHP Code:
    echo(" window.location('merge_cart.php?oldsession=" .urlencode($cart["sessionId"])); 
    is making it...

    window.location('merge_cart.php?oldsession=sessionId

    PHP Code:
    echo(" window.location('merge_cart.php?oldsession=" .urlencode($cart['sessionId'])"');"); 
    will output

    window.location('merge_cart.php?oldsession=23425');

    23425 is an example

    and i think you need

    <script type="text/javascript">
    <!--

    //-->
    </script>

    in the echo somewhere
    im not sure if this will work but.....


    PHP Code:
    echo(" <script type='text/javascript'>
    <!-- window.location('merge_cart.php?oldsession=" 
    .urlencode($cart['sessionId'])"'); //-->
    </script>"
    ); 


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •