Javascript php popitup window not working... Help

Discussion in 'PHP' started by jackdaniels187, Feb 14, 2010.

  1. #1
    Alright I am trying to deal with a small issue.

    I need to have a javascript popup link echod by php.

    This is the code I have now. I know it doesn't work. the quotes just aren't in the right place, can someone figure it out?

     print '<a href="unit_note1.php?id='.$unitid." onClick=\"return popitup(\'unit_note1.php?id='.$unitid.'\')">Click here</a>';  
    PHP:
    Here is another instance I am using this but it is setup as html

    <a href="unit_note1.php?id=<? print $unitid; ?>" onClick="return popitup('unit_note1.php?id=<? print $unitid; ?>')">Add note</a>
    HTML:
     
    jackdaniels187, Feb 14, 2010 IP
  2. danx10

    danx10 Peon

    Messages:
    1,179
    Likes Received:
    44
    Best Answers:
    2
    Trophy Points:
    0
    #2
    print("<a href=\"unit_note1.php?id=".$unitid."\" onClick=\"return popitup('unit_note1.php?id=".$unitid."')\">Add note</a>");
    PHP:
     
    danx10, Feb 14, 2010 IP
  3. Will Bontrager

    Will Bontrager Peon

    Messages:
    14
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    This might work.

    <?php
    $query = empty($_SERVER['QUERY_STRING']) ? '' : '?' . urldecode($_SERVER['QUERY_STRING']);
    echo 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . $query;
    ?>
    Code (markup):
    Will
     
    Will Bontrager, Feb 14, 2010 IP
  4. danx10

    danx10 Peon

    Messages:
    1,179
    Likes Received:
    44
    Best Answers:
    2
    Trophy Points:
    0
    #4
    Im sure all that returns is the current page url, all he wanted is for his html to be backslashed accordingly, so it can be parsed in php.
     
    danx10, Feb 15, 2010 IP
  5. Will Bontrager

    Will Bontrager Peon

    Messages:
    14
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Ah, my bad. I thought he wanted to echo the popup URL in the popup window itself.

    Will
     
    Will Bontrager, Feb 15, 2010 IP
  6. Will Bontrager

    Will Bontrager Peon

    Messages:
    14
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Perhaps this will work.

    <?php
    $unitid = 'AAA';
    print("<a href=\"unit_note1.php?id=$unitid\" onClick=\"return popitup('unit_note1.php?id=$unitid')\">Add note</a>");
    ?>
    Code (markup):
    The above prints this.

    <a href="unit_note1.php?id=AAA" onclick="return popitup('unit_note1.php?id=AAA')">Add note</a>
    Code (markup):
    Will
     
    Will Bontrager, Feb 15, 2010 IP