Connecting Tech Pros Worldwide Help | Site Map

HTML tables

 
LinkBack Thread Tools Search this Thread
  #1  
Old March 4th, 2006, 04:25 PM
Netko
Guest
 
Posts: n/a
Default HTML tables

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?


  #2  
Old March 4th, 2006, 06:15 PM
Carl Vondrick
Guest
 
Posts: n/a
Default Re: HTML tables

Netko wrote:[color=blue]
> 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?
>[/color]

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
  #3  
Old March 4th, 2006, 06:25 PM
Richard Levasseur
Guest
 
Posts: n/a
Default Re: HTML tables

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)

  #4  
Old March 4th, 2006, 06:55 PM
Carl Vondrick
Guest
 
Posts: n/a
Default Re: HTML tables

Richard Levasseur wrote:[color=blue]
> Once you output the data to the browser, you can't access it using PHP.[/color]

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
  #5  
Old March 4th, 2006, 07:05 PM
Netko
Guest
 
Posts: n/a
Default Re: HTML tables

Datuma 4 Mar 2006 11:12:39 -0800, Richard Levasseur je napisao\la:
[color=blue]
> 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)[/color]

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
  #6  
Old March 5th, 2006, 12:25 AM
Mladen Gogala
Guest
 
Posts: n/a
Default Re: HTML tables

On Sat, 04 Mar 2006 18:08:24 +0100, Netko wrote:
[color=blue]
> 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?[/color]


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

 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.