1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

how to output php in a javascript file .js

Discussion in 'Cloaking and Content Generators' started by sapo, Jun 2, 2012.

  1. sapo

    sapo Power Member

    Joined:
    Feb 25, 2008
    Messages:
    510
    Likes Received:
    281
    im tyring to add my php varible to an url

    for example.

    php varible is

    Code:
    <?php echo 'hello!'; ?>
    and my javscript is

    Code:
    var = 'http://site.com/login/?

    i need to parse the php into the url like this

    Code:
    var = 'http://site.com/login/?[php varible]'
    I just cant figure it out this is what I came up with but you guessed it doesnt work

    Code:
    var = url = 'http://site.com/' + '.document.write("<?php echo 'hello!'; ?>")';'

    any help will be greatly apperciated. reps and thanked
     
    Last edited: Jun 2, 2012
  2. dbyrn

    dbyrn Power Member

    Joined:
    Feb 20, 2010
    Messages:
    746
    Likes Received:
    224
    Occupation:
    helping people
    Try something like this.
    Code:
    var = 'http://site.com/login/?<?php echo $a_php_variable; ?>'
    I assume that your page is a .php page.

    D.
     
  3. sapo

    sapo Power Member

    Joined:
    Feb 25, 2008
    Messages:
    510
    Likes Received:
    281
    its a .js file. I am trying to call the php variable form inside a .js file
     
  4. sapo

    sapo Power Member

    Joined:
    Feb 25, 2008
    Messages:
    510
    Likes Received:
    281
    LOL man IM a idiot. Thanks. i as trying to do it in reverse dont know lol. been trying to figure this out for hours non stop and finally took a step back drank tall can and bam came back and bam it clicked.
     
  5. dbyrn

    dbyrn Power Member

    Joined:
    Feb 20, 2010
    Messages:
    746
    Likes Received:
    224
    Occupation:
    helping people
    The hardest thing is to find a little stupid mistake. I know I've been coding for many, many years.

    D.
     
    • Thanks Thanks x 1