help getting value of cell and passing to PHP file

Discussion in 'Javascript' started by Matt Williamson, Aug 1, 2005.

  1. I have a table that gets generated every 5 minutes containing the drive
    space on my servers. The table is sortable via an external javascript file
    by clicking the column headers (using sortable.js found here:
    http://www.kryogenix.org/code/browser/sorttable/) the first 2 cells of the
    table are the server name and drive. When the server name in the first cell
    of any row is clicked on, I want to get the value of the data from that rows
    table cells and pass them to a PHP file that creates a chart of the data.
    I'm pretty sure javascript is the way to go, but I haven't figured out the
    right way to do it. If anyone has a suggestion as to the best way to
    accomplish this, I'd really appreciate it.

    TIA

    Matt
    Matt Williamson, Aug 1, 2005
    #1
    1. Advertising

  2. Matt Williamson

    Randy Webb Guest

    Matt Williamson said the following on 7/31/2005 11:26 PM:
    > I have a table that gets generated every 5 minutes containing the drive
    > space on my servers. The table is sortable via an external javascript file
    > by clicking the column headers (using sortable.js found here:
    > http://www.kryogenix.org/code/browser/sorttable/) the first 2 cells of the
    > table are the server name and drive. When the server name in the first cell
    > of any row is clicked on, I want to get the value of the data from that rows
    > table cells and pass them to a PHP file that creates a chart of the data.


    Make the server name a button that submits a form that has hidden fields
    that contain the data that PHP needs to create the chart. No JS needed
    at all.

    Each Server Drive would have it's own form and fields.

    > I'm pretty sure javascript is the way to go, but I haven't figured out the
    > right way to do it. If anyone has a suggestion as to the best way to
    > accomplish this, I'd really appreciate it.


    You could use JS to do it, but why introduce a needless dependency on
    client-side scripting?

    --
    Randy
    comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
    Randy Webb, Aug 1, 2005
    #2
    1. Advertising

  3. I see what you're saying. I just figured since I was already using the
    javascript to sort the table, that it would take less code in javascript
    than doing the submit in HTML. Any html changes I make will require me to
    completely re-write the script that generates the code and adding a
    javascript function would be the easiest way to do it.

    I've been trying to figure out how to use the hidden fields to do a post of
    the data to my PHP script, but I haven't worked it out. Could you give me a
    quick example of the HTML that would do what you suggested?

    TIA

    Matt

    "Randy Webb" <> wrote in message
    news:...
    > Matt Williamson said the following on 7/31/2005 11:26 PM:
    > > I have a table that gets generated every 5 minutes containing the drive
    > > space on my servers. The table is sortable via an external javascript

    file
    > > by clicking the column headers (using sortable.js found here:
    > > http://www.kryogenix.org/code/browser/sorttable/) the first 2 cells of

    the
    > > table are the server name and drive. When the server name in the first

    cell
    > > of any row is clicked on, I want to get the value of the data from that

    rows
    > > table cells and pass them to a PHP file that creates a chart of the

    data.
    >
    > Make the server name a button that submits a form that has hidden fields
    > that contain the data that PHP needs to create the chart. No JS needed
    > at all.
    >
    > Each Server Drive would have it's own form and fields.
    >
    > > I'm pretty sure javascript is the way to go, but I haven't figured out

    the
    > > right way to do it. If anyone has a suggestion as to the best way to
    > > accomplish this, I'd really appreciate it.

    >
    > You could use JS to do it, but why introduce a needless dependency on
    > client-side scripting?
    >
    > --
    > Randy
    > comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
    Matt Williamson, Aug 2, 2005
    #3
  4. Matt Williamson

    Randy Webb Guest

    Matt Williamson said the following on 8/1/2005 7:05 PM:
    > I see what you're saying. I just figured since I was already using the
    > javascript to sort the table, that it would take less code in javascript
    > than doing the submit in HTML. Any html changes I make will require me to
    > completely re-write the script that generates the code and adding a
    > javascript function would be the easiest way to do it.


    <shrug> code is code, just a different language is all.

    But make your drive letters links, that have a URL something like this:
    <a href="drawMap.php?<drive letter here>">Humpty Dumpty Drive</a>

    And then the drawMap.php file can pick it up and draw the map.

    Since PHP is generating the page every 5 minutes, it would know the
    parameters to add to the URL that it needs, such as drive letter, drive
    name, free space, etc...

    And I promise, that is a *lot* easier than trying to have JS do it.

    --
    Randy
    comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
    Randy Webb, Aug 2, 2005
    #4
  5. I figured out how to do it after reading a few older posts and munging the
    code I found in them. I decided it was better to just use one form and use
    some javascript to update the hidden fields and submit it to my PHP script.


    "Matt Williamson" <> wrote in message
    news:...
    > Yeah, that would be if that were the case. The code is being generated via

    a
    > locally run VBScript file using task scheduler on one of my servers. I put
    > an example of the html output up on my own public webserver here:
    > http://www.crxtasy.org/ds/drivespace.htm Right now, I have the server name
    > being written as a hyperlink just using local filesystem links. I thought
    > about what I'd like to do a little more and decided that I'd rather be

    able
    > to click on any cell entry and have it send that value along with the

    server
    > and drive to the PHP script so I can have a graph of the server and drive

    in
    > question and get the used space or freespace or whatever else I add to the
    > original script. Is that still workable using the form and hidden fields?

    I
    > think that might require some javascript as well though.. I've spent the
    > last few hours trying to find any examples that would show how to do it,

    but
    > I haven't found anything yet.
    >
    > Thanks for your help
    >
    > Matt
    >
    >
    > "Randy Webb" <> wrote in message
    > news:...
    > > Matt Williamson said the following on 8/1/2005 7:05 PM:
    > > > I see what you're saying. I just figured since I was already using the
    > > > javascript to sort the table, that it would take less code in

    javascript
    > > > than doing the submit in HTML. Any html changes I make will require me

    > to
    > > > completely re-write the script that generates the code and adding a
    > > > javascript function would be the easiest way to do it.

    > >
    > > <shrug> code is code, just a different language is all.
    > >
    > > But make your drive letters links, that have a URL something like this:
    > > <a href="drawMap.php?<drive letter here>">Humpty Dumpty Drive</a>
    > >
    > > And then the drawMap.php file can pick it up and draw the map.
    > >
    > > Since PHP is generating the page every 5 minutes, it would know the
    > > parameters to add to the URL that it needs, such as drive letter, drive
    > > name, free space, etc...
    > >
    > > And I promise, that is a *lot* easier than trying to have JS do it.
    > >
    > > --
    > > Randy
    > > comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly

    >
    >
    Matt Williamson, Aug 2, 2005
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. news.rcn.com
    Replies:
    1
    Views:
    9,630
    Chris Smith
    Jul 12, 2004
  2. Rajive Narain
    Replies:
    0
    Views:
    1,563
    Rajive Narain
    Sep 18, 2009
  3. RJ
    Replies:
    1
    Views:
    229
    Eliyahu Goldin
    Feb 17, 2005
  4. Nautilus
    Replies:
    2
    Views:
    161
    Nautilus
    Oct 13, 2004
  5. M. Strobel
    Replies:
    1
    Views:
    201
    The Natural Philosopher
    Mar 5, 2013
Loading...

Share This Page