hey all, been a while since i was this stumped.

i have main.php which calls in an iframe child.php

child.php is only a table it has lots of TDs in it.

now what i want to do is to have a button on main.php that when pressed creates an XLS file of the table in child.php

so far i have tried using javascript which is great at looking through the child table, it works great, i can go one cell at a time and get the values no problem. but i cant get that to export into xls in all browsers. ( if someone knows how to do this - and shows me then i am saved )

when i call a new file excel.php with the button i can use the header stuff to send output to an xls file. this also works fine. i can create an xls file now. but i cant figure out how to access the main file's child data with php. so again if someone could show me how to access a child of a parent in php i am saved.

so... :-) help, i need somebody, help, not just aaaaanybody... pleeeaase... ( cant remember the rest of the song. )

You could have Javascript just create an array of data, JSON encode the array, set that to a form value and submit the form to a PHP page which itself creates the CSV instead of having PHP or Javascript do it all

i am totally willing to do that. that would be great uhhh.... do you have an example?
:icon_smile:

Well you said Javascript works fine for looking through the tables so instead of trying to make the CSV with Javascript just set a form field to the data you've gathered ie.,

<form action="create_csv.php" id="create_csv"><input type="hidden" name="csv_data" id="csv_data"/></form>
<script type="text/javascript">
// whatever magic you're doing to gather the data
document.getElementById('data_csv').value = yourawesomedata;
document.getElementById('create_csv').submit(); // submit yourawesome data to the PHP script create_csv.php
</script>

let me try that boss... whoo... what a road! ( and some more of the song is coming to me, but i kinda mumble it while i sing, so its more of the melody than the lyrics. )

ok - that did it. cleaning up the edges now but it looks like thats it. :-) thanks again

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.