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. )

8 Years
Discussion Span
Last Post by sparf

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?


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

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.