Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
|
You cannot operate that way.
PHP being a server side language, and javascript a client side, you will just write php code in the local user browser, but it won't get interpreted.
To do what you are trying to do, you must:
1) create a page on your server that will get the datas you need (either passed from a form, or fetched from a db)
2) Create a link to that page, giving the necessary parameters in the call
When the user will land on the page, the server will create the file via PHP.
From there, you can do everything you want with your file.
Get it via FTP, or create another link that will allow the user to download it via his browser, store it as backup...
It's up to you.
Edit:
The page being still loading is because when you use javascript to write in a newly created window, you need to do a document.close(); at the end of your script to explicitly tell the browser that you have finished writing in it.
When doing document.write in a physically existing page, there is no need for it, as the browser already have closed it. You are adding more content, not creating it from scratch.
__________________
Only a biker knows why a dog sticks his head out the window.
Last edited by tripy; 05-30-2007 at 05:10 PM..
|