Jump to content

Recommended Posts

Hi,

 

I have a PHP web application that I want to customise slightly. It generates two tables; one with showing the current week, the second showing next week.

 

Is it possible to say:

 

<?php

if (table == #1 AND table cell == 2,6)

{echo 'This is the cell that lies in the 2nd column and the 6th row';}

?>

 

To possibly complicate things, this table is generated by PHP.

 

Thank you!

Link to comment
https://forums.phpfreaks.com/topic/182127-php-check-table-cell/
Share on other sites

Is it possible to say:

 

<?php

if (table == #1 AND table cell == 2,6)

{echo 'This is the cell that lies in the 2nd column and the 6th row';}

?>

Do you mean an HTML table displayed in a web page? Or a 2D array?

 

If you mean an HTML table displayed in a web page, you can inspect table cells using javascript. If you then want that information passed to a PHP script, you'll either need to submit the data via a form, capture it as its generated and save it to an array or database table, or use Ajax to dynamically save it to a database.

 

If the HTML table is being generated by PHP on the fly, and doesn't change (i.e. no dynamic changing of content going on after the page has been created), you should have PHP capture each cell as it generates it, and save the information in an array.

 

If that information has to survive a page refresh, you'll need to insert in into a back-end database (best) or save it to a text file (worst). Then you can retrieve it from any other page.

 

It would be useful if you could be more specific about what type of table you're referring to, how it's created, and whether or not you're retaining this formation. And perhaps links to a specific example, or post some code.

Link to comment
https://forums.phpfreaks.com/topic/182127-php-check-table-cell/#findComment-961047
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.