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 9 of 9
  1. #1
    Regular Coder ajetrumpet's Avatar
    Join Date
    Jul 2009
    Location
    Iowa City, IA
    Posts
    407
    Thanks
    44
    Thanked 5 Times in 5 Posts

    using PHP to populate a spry panel

    all,

    how, in general, can you run PHP/MYSQL queries without reloading a webpage? The first thing I learned about server side languages was that they execute first, no matter where the code is written. But if I wanted to put a collapsible spry widget on my webpage under a few dropdown boxes, and then wanted to expand that widget to list the contents of my database based on the dropdown criteria, how would I go about that?

    I can get just about everything else done except the task of not reloading the page to execute the PHP query. What I essentially want is the collapsible panel to expand with the mysql data that is queried. Can someone give some insight on this please? thanks!

  • #2
    Senior Coder
    Join Date
    Jun 2008
    Location
    New Jersey
    Posts
    2,536
    Thanks
    45
    Thanked 259 Times in 256 Posts
    To get a page to change without reloading, you need client side technology, like Flash or Javascript. You cannot do it with PHP alone. For what you want, you'd need to build/find an AJAX module.

  • #3
    New Coder
    Join Date
    Nov 2010
    Location
    Kenya
    Posts
    42
    Thanks
    4
    Thanked 1 Time in 1 Post
    use frames and/or ajax. php alone will not help.

  • #4
    Regular Coder ajetrumpet's Avatar
    Join Date
    Jul 2009
    Location
    Iowa City, IA
    Posts
    407
    Thanks
    44
    Thanked 5 Times in 5 Posts
    Quote Originally Posted by bngari View Post
    use frames and/or ajax. php alone will not help.
    are you talking about the frame tag in HTML? I can go to w3schools and learn a little bit about them. Or are you talking about iFrames? What's the difference mind you?

  • #5
    Senior Coder
    Join Date
    Jun 2008
    Location
    New Jersey
    Posts
    2,536
    Thanks
    45
    Thanked 259 Times in 256 Posts
    Iframes allow you to basically open a new window in your current window... frames allow you to section off the website and run content in them.

    In either case, I recommend against either. Frames are outdated and problematic. It makes bookmarking content, moving between content messy.

  • #6
    Regular Coder ajetrumpet's Avatar
    Join Date
    Jul 2009
    Location
    Iowa City, IA
    Posts
    407
    Thanks
    44
    Thanked 5 Times in 5 Posts
    Quote Originally Posted by Keleth View Post
    Iframes allow you to basically open a new window in your current window... frames allow you to section off the website and run content in them.

    In either case, I recommend against either. Frames are outdated and problematic. It makes bookmarking content, moving between content messy.
    then I'm assuming all of the pages I see that dropdown panels like that and fill them with database content are using AJAX code, huh? Is that accurate?

  • #7
    Senior Coder
    Join Date
    Jun 2008
    Location
    New Jersey
    Posts
    2,536
    Thanks
    45
    Thanked 259 Times in 256 Posts
    Quote Originally Posted by ajetrumpet View Post
    then I'm assuming all of the pages I see that dropdown panels like that and fill them with database content are using AJAX code, huh? Is that accurate?
    I doubt ALL, but a lot, sure. Most, probably. Any professionally well done site today? I'd bet.

  • #8
    Senior Coder
    Join Date
    Jul 2009
    Location
    South Yorkshire, England
    Posts
    2,318
    Thanks
    6
    Thanked 304 Times in 303 Posts
    Quote Originally Posted by ajetrumpet View Post
    then I'm assuming all of the pages I see that dropdown panels like that and fill them with database content are using AJAX code, huh? Is that accurate?
    Large percentage probably are. All the basic method consists of is either an empty container, paragraph, div or whatever type takes your fancy on the page, then get the content via AJAX and write the response text to the container via JS, or even create the container from scratch via JS too. As Keleth says, frames are a poor choice.

  • #9
    New Coder
    Join Date
    Nov 2010
    Location
    Kenya
    Posts
    42
    Thanks
    4
    Thanked 1 Time in 1 Post
    it was a typo...iframes.


  •  

    Posting Permissions

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