How to extract table data from article with PHP?
-
I have CMS website, maked in Joomla. There are articles about traveling and I've dates in there. Dates are in tables on each page. Question is how to extract dates like array from table inherit in article and copy them in dropdown box in contact form? This is exampe, tr> <td>08.03.2012. </td> <td>22.03.2012.</td> </tr> How to extract those dates and put in dropdown box in contact form? Thank you!
-
Answer:
Check out PHP's DOMXPath class. It will parse XML or HTML strings and extract any elements that match the path you specify. For your example, a path of "//tr/td" would capture an array of td elements that are within a tr element. Of course you should use some qualifiers to capture only the td cells you are interested in. Something like the following might work. "//table[@id='tableID']/tr/td" Take a little time to review the concept of XPATH and how to integrate it into PHP and you should be good to go.
darko k at Yahoo! Answers Visit the source
Other answers
javascript assign an id to each td you want to collect the data from <td id='date1'>22.03.2012.</td> if your looking to use php you would need to post the data from this page to the next. <body onload='document.myformid.submit();> echo "<form name='myformid' action=' mynextpage.com' >"; for($i=0;$i>=$countarray-1;$i++) { echo "<input <button= 'hidden' id='$i' type= 'hidden' value='' />" } echo </form> <script type javascript> for($i=0;$i>=$countarray-1;$i++) { document.forms[0]elimint[$i].value = document.getdocumentby('date[$i]').inner… } </script>
Mark O
Related Q & A:
- How To Extract Zipx Online?Best solution by solvusoft.com
- how to extract video and audio meta data?Best solution by Stack Overflow
- How to extract parts of (La)TeX document?Best solution by TeX - LaTeX
- How would you transfer data between your data structures and databases?Best solution by Programmers
- How to extract data from any website?Best solution by Stack Overflow
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.