How to open a new window (popup window) with PHP?

Discussion in 'PHP' started by Javver, Feb 18, 2008.

  1. #1
    How to open a new window (popup window) with PHP? where i can also adjust the size of the window in the script?
     
    Javver, Feb 18, 2008 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    PHP is not capable of doing that. You need Javascript.

    And you can find a LOT of examples with Google.
     
    nico_swd, Feb 18, 2008 IP
  3. Javver

    Javver Active Member

    Messages:
    72
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    91
    #3
    thanks for the advise

    i have one now.. thanks a lot!
     
    Javver, Feb 18, 2008 IP
  4. rajarak

    rajarak Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Were u able to get in PHP or JScript?

    Thanks
     
    rajarak, Jun 30, 2008 IP
  5. Vooler

    Vooler Well-Known Member

    Messages:
    1,146
    Likes Received:
    64
    Best Answers:
    4
    Trophy Points:
    150
    #5
    Secondly, most of today's browsers block popup windows. So better is fins some solution that creates a pop-like child windows within the page, I can provide such code if needed. And also, it can be made dragable using mouse button.

    regards
     
    Vooler, Jun 30, 2008 IP
  6. rajarak

    rajarak Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Can you gimme some directions or sample code on opening such child windows within the page

    Thank you for your time!!
     
    rajarak, Jun 30, 2008 IP
  7. Vooler

    Vooler Well-Known Member

    Messages:
    1,146
    Likes Received:
    64
    Best Answers:
    4
    Trophy Points:
    150
    #7
    Sure raja.

    Here goes our Vooler popUp

    <script language="javascript">
    function show_popup(id) {
    	if (document.getElementById){ 
    		obj = document.getElementById(id); 
    		if (obj.style.display == "none") { 
    			obj.style.display = ""; 
    		} 
    	} 
    }
    function hide_popup(id){ 
    	if (document.getElementById){ 
    		obj = document.getElementById(id); 
    		if (obj.style.display == ""){ 
    			obj.style.display = "none"; 
    		} 
    	} 
    }
    </script>
    
    <div id="my_popup" style="display:none;border:1px dotted gray;padding:.3em;background-color:white;position:absolute;width:200px;height:200px;left:100px;top:100px">
    	<div align="right">
    		<a href="javascript:hide_popup('my_popup')">close</a>
    	</div>
    <h3>Vooler PopUp</h3>
    <p>You contents go here, whatever style or anything</p>
    </div>
    
    
    Somewhere in code
    <a href="javascript:show_popup('my_popup')">Show popup</a>
    HTML:

    I hope it helps.

    regards
     
    Vooler, Jun 30, 2008 IP
  8. mordimi

    mordimi Active Member

    Messages:
    177
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #8
    or this example
    <script type="text/javascript">
     <!--
      var stile = "top=10, left=10, width=600, height=800 status=no, menubar=no, toolbar=no scrollbar=no";
         function Popup(apri) {
            window.open(apri, "", stile);
         }
     //-->
    </script>
    <a href="javascript:Popup('YOURPAGE.html')">show popup</a>
    
    PHP:
    cheers
     
    mordimi, Jun 30, 2008 IP
  9. rajarak

    rajarak Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    thank you so much,
    it does helps!!
     
    rajarak, Jun 30, 2008 IP