Click here to Skip to main content
15,894,405 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Is it possible to use the php fwrite function to send data to a .txt file in a html file?

What I have tried:

I have tried this, but how can I make the .txt file in html where the data is sent to?
Posted
Updated 1-Jan-18 1:01am

1 solution

What you have to understand is that a PHP file have two parts: one that running on the server (PHP) and the other created by that run that goes to the client (HTML)... PHP fwrite will write will work on the server (and has no effect on the final HTML), so the answer is: no!
 
Share this answer
 
Comments
KajLao 1-Jan-18 7:19am    
Okay. So is it possible to do this in another way? Without a free web hosting service
Kornfeld Eliyahu Peter 1-Jan-18 7:22am    
PHP can run without web hosting (as command line tool - CLI), but then HTML is irrelevant...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900