jsteel Posted November 19, 2009 Share Posted November 19, 2009 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! Quote Link to comment https://forums.phpfreaks.com/topic/182127-php-check-table-cell/ Share on other sites More sharing options...
megaresp Posted November 19, 2009 Share Posted November 19, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/182127-php-check-table-cell/#findComment-961047 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.