SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Wizard lukeurtnowski's Avatar
    Join Date
    Mar 2003
    Location
    Coronado
    Posts
    1,618
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    pop-up window using php?

    What is the best way to opening a link to a pop-up window...(like this?)
    PHP Code:
        print '<th><a href="/provider_page.php?ID=' .$row['ID']. '" onClick="popup = window.open('"/provider_page.php?ID=".$row['ID']."', 'Chat', 'height=700,width=800,scrollbars=no,resizable=yes'); return false" target="_blank" title="Provider Page"><img src="/images/ASP_Images/' .$Img1. '" alt="ASP_Image" class="thumb"/></a></td>'; 
    "Oh, and Jenkins--apparently your mother died this morning."

  2. #2
    rajug.replace('Raju Gautam'); bronze trophy Raju Gautam's Avatar
    Join Date
    Oct 2006
    Location
    Kathmandu, Nepal
    Posts
    4,013
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you are not going to use javascript then you can open a new window setting target=_blank in the anchor tag. Else javascript will be the best way to open a pop up.
    PHP Code:
    echo '<a href="./mypage.php?id=' $ID '" target="_blank">Link Name</a>'
    But you cannot have the width and height.
    Using JavaScript is simple:
    PHP Code:
    echo '<a href="javascript:void(null);" onclick="window.open(\'mypage.php?id=' $ID . \'',\'MyWin\',\'width=200,height=300\');">Link Name</a>'
    Mistakes are proof that you are trying.....
    ------------------------------------------------------------------------
    PSD to HTML - SlicingArt.com | Personal Blog | ZCE - PHP 5

  3. #3
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,788
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Opening a new window is a behaviour not part of the content and so JavaScript rather than HTML is the way to code it. The window size and toolbars to display are just recommentdations though as your visitor gets the final say.

    Never use href="javascript: - use onclick= for triggering JavaScript and put a real address in the href for those with Javascript disabled.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  4. #4
    SitePoint Wizard lukeurtnowski's Avatar
    Join Date
    Mar 2003
    Location
    Coronado
    Posts
    1,618
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    thank you, I was woried about that...
    "Oh, and Jenkins--apparently your mother died this morning."


Bookmarks

Posting Permissions

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