Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > help getting value of cell and passing to PHP file

Reply
Thread Tools

help getting value of cell and passing to PHP file

 
 
Matt Williamson
Guest
Posts: n/a
 
      08-01-2005
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


 
Reply With Quote
 
 
 
 
Randy Webb
Guest
Posts: n/a
 
      08-01-2005
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
 
Reply With Quote
 
 
 
 
Matt Williamson
Guest
Posts: n/a
 
      08-01-2005
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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



 
Reply With Quote
 
Randy Webb
Guest
Posts: n/a
 
      08-02-2005
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
 
Reply With Quote
 
Matt Williamson
Guest
Posts: n/a
 
      08-02-2005
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 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

>
>




 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: getting perl and php to talk to each other, was Re: randomlysorting files in php M. Strobel Perl Misc 1 03-05-2013 07:20 PM
PHP Training Institute In Delhi, Live Projects on PHP. Short TermPHP Courses, PHP Scripts, PHP Training with Live Projects. Rajive Narain Java 0 09-18-2009 10:47 AM
How to set cell background based on cell value when datagrid is displayed RJ ASP .Net Datagrid Control 1 02-17-2005 09:37 PM
Trouble passing JS parameter to PHP program /or/ executing the PHP Nautilus Javascript 2 10-13-2004 09:55 PM
moving to cell Y if cell X has value Z. Clarke Rice Computer Support 0 06-30-2003 09:35 AM



Advertisments