Sending data to two different php scripts on seperate pages??

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • buggtb
    New Member
    • Apr 2007
    • 7

    Sending data to two different php scripts on seperate pages??

    This may be a blindingly obvious question but I am working on a little project and I'm relatively new to PHP. What I am wanting to do it load a load of data from an array into a table generated by php.... simple enough.

    Anyway our table is huge and when you scroll along you loose your row headings which is annoying to say the least.
    So I created a seperate frame to act as a 2nd column in our page which I was hoping to load the array names into as they are the row headers into the frame on the left and then the rest of the array's data into the frame on the right.

    I currently have a rather messy but working script that loads all the data into one large table, I know how to extract the row headers but what is the best way of going about writing the data to a seperate page?

    I mean can I put a function in the left frame so that any table I load and push data to it will put the headers in and if so how do I go about calling a function on a seperate page? and how about updating the page with the correct data? or is there a more obvious way of going about it?

    Sorry for the rather rambling post...

    Tom
  • Motoma
    Recognized Expert Specialist
    • Jan 2007
    • 3236

    #2
    I am not entirely sure what you are trying to do. Why are you using two separate php pages?

    Care to have another go at explaining your site? I think that you are looking for a simple answer to a simple problem in complex code, where there may be simple code which could replace your complex code altogether.

    Comment

    • code green
      Recognized Expert Top Contributor
      • Mar 2007
      • 1726

      #3
      Are you trying to do pagination?

      Comment

      • adamalton
        New Member
        • Feb 2007
        • 93

        #4
        Err... bit of a funny one, I'm sure there must be a less crude solution.

        But if you want to have a frameset with half the table in one frame and half in the other, then the answer might be to put the data from your php into a javascript array, and then when the 2nd frame loads have some javascript in that frame that takes all the data from the array and sticks it into the table.
        Have this in your main page:
        <script language="javas cript>
        java_array=new Array;
        [PHP]
        foreach( $your_array as $key => $data)
        { print "java_array[$key] = '$data'; "; }
        [/PHP]
        </script>

        Then in your 2nd frame have:

        <table><tr>
        <script language=javasc ript>
        var x;
        for (x in java_array)
        {
        document.write( "<td>" + java_array[x] + "</td>")
        }
        </script>
        </tr></table>

        I haven't tested any of that, so it may not work!!

        Have you considered that if you have one half of the table in one frame and one half in another frame that when the user scrolls down the page in one frame the other one wont move with it so the talble rows wont line up!!

        Comment

        • Atli
          Recognized Expert Expert
          • Nov 2006
          • 5062

          #5
          I have no clue what your talkin about. Could you try to explain a little better?

          I did however gather that you have a lot of data in one big ugly table. Have you considered displaying only a part of it per page? Say 20 entries per page or sumthing?

          Comment

          Working...