This is a discussion on HTML tables within the PHP Language forums, part of the PHP Programming Forums category; I'm new to php and i need ur help. I have HTML table that is made form 4 columns ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I'm new to php and i need ur help.
I have HTML table that is made form 4 columns and x rows. I am wondering if there is any function that could get data from specific cell into variable? Example: I have some variable $var and i would like to put data from some cell x,y into that variable. Can someone help me? |
|
|||
|
Netko wrote:
> I'm new to php and i need ur help. > > I have HTML table that is made form 4 columns and x rows. > > I am wondering if there is any function that could get data from specific > cell into variable? > > Example: > > I have some variable $var and i would like to put data from some cell x,y > into that variable. > > Can someone help me? > Take a look at SimpleXML. As long as you are writing your pages in XHTML, this should do exactly what you want. -- Carl Vondrick www.carlsoft.net usenet [at] carlsoft [dot] net |
|
|||
|
Once you output the data to the browser, you can't access it using PHP.
If you want to change the table after its been outputted, use javascript (and ask in the appropriate group) If you are storing the table in an array, then to access a specific cell you would just do: $var = $table_data[2][1]; // this accesses row 3, column 2 (because zero is the starting row or column) |
|
|||
|
Richard Levasseur wrote:
> Once you output the data to the browser, you can't access it using PHP. My assumption was that he wanted to access the HTML before it was spitted to the browser (such as buffering). -- Carl Vondrick www.carlsoft.net usenet [at] carlsoft [dot] net |
|
|||
|
Datuma 4 Mar 2006 11:12:39 -0800, Richard Levasseur je napisao\la:
> Once you output the data to the browser, you can't access it using PHP. > > If you want to change the table after its been outputted, use > javascript (and ask in the appropriate group) The table with data isnt output in browser, but it is html file on server. But thx anyway, i think i got it with SimpleXML |
|
|||
|
On Sat, 04 Mar 2006 18:08:24 +0100, Netko wrote:
> I'm new to php and i need ur help. > > I have HTML table that is made form 4 columns and x rows. > > I am wondering if there is any function that could get data from > specific cell into variable? > > Example: > > I have some variable $var and i would like to put data from some cell > x,y into that variable. > > Can someone help me? What you want is something like Perl HTML::TableParser module. http://search.cpan.org/~djerius/HTML...TableParser.pm Unfortunately, PHP doesn't have CPAN and you can try finding something on http://www.phpclasses.org, write your own parser, which shouldn't be too hard, or just write the whole darned thing in Perl. -- http://www.mgogala.com |