Results 1 to 6 of 6
  1. #1
    4 Star Lounger
    Join Date
    Feb 2008
    Location
    United Kingdom
    Posts
    490
    Thanks
    0
    Thanked 0 Times in 0 Posts

    PHP submit to DIV included file

    I have a page with 2 DIV sections, each having an include file. The left DIV section displays a listbox for selection, and a submit button. The listbox selections are MySql record ID's. The righthand DV section has an included file which displays content of the database record selected. How do I submit a list selection to the file in the righthand section. At present my submit button opens the form being posted to in a new page, ie the page itself. Hope this is clear and someone can put me on the right road. Thanks

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: PHP submit to DIV included file

    A PHP include is completed on the server. By the time the page is served to the browser, it all looks like one page. So you can't replace or re-do the include on the client side.

    If you do not want to load a new page, you could accomplish this by changing your right <div> to an <iframe>. Since the <iframe> contains an independent document, you should be able to post to it (using the target attribute). Or maybe it requires scripting? I can't recall for sure.

    It is possible to keep the <div> and replace its contents, but this requires heavy scripting. You would need to post the form in script in order to capture the return HTML, and insert it into the <div> with script. Welcome to "AJAX".

  3. #3
    4 Star Lounger
    Join Date
    Feb 2008
    Location
    United Kingdom
    Posts
    490
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: PHP submit to DIV included file

    Many thanks. So I will have to do some research into Iframes, and seem to be going in circles. I started of doing my work with frames, but everyone told me you don't need them, and look into DIV. Basically I am tying to recreate a network database in a web application. My left side, frame, DIV or whatever has an include file. It is filled with a listbox of database records. In the right hand side I have another DIV with an include file that displays the database fields. I want to select a record from the list, and it then shows that records contents in the right pane. I had been told that I could do this with DIV's but no so now. Maybe an Iframe is not a frame, might be talkting too soon, hope so. Regards

  4. #4
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: PHP submit to DIV included file

    An <iframe> is a frame, in the sense that it is a rectangle that hosts a different page, but it is embedded inside your page rather than being managed separately by the browser.

  5. #5
    4 Star Lounger
    Join Date
    Feb 2008
    Location
    United Kingdom
    Posts
    490
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: PHP submit to DIV included file

    Many thanks for the information. I now have to find how I can submit from iframe1 to iframe2, and refresh the contents in the iframe. So on goes the hunt, thanks again

  6. #6
    4 Star Lounger
    Join Date
    Feb 2008
    Location
    United Kingdom
    Posts
    490
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: PHP submit to DIV included file

    Just to thankyou again, I got there. Best regards

Posting Permissions

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