How do I run a php script who runs a function which saves something on a .txt file without refreshing that php function? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How do I run a php script who runs a function which saves something on a .txt file without refreshing that php function?

maybe an example, please?

20th Mar 2017, 7:12 AM
Ciubotaru Bogdan
Ciubotaru Bogdan - avatar
2 Answers
+ 8
Asynchronous Javascript and XML (AJAX). Have JS invoke PHP by sending information without reloading to a file > PHP then follows instructions/code accordingly.
20th Mar 2017, 6:04 PM
Mark Foxx
Mark Foxx - avatar
+ 6
$file = fopen('myfile.txt', 'a'); fwrite($file, "Some text"); fclose($file); If you want input from form without refreshing then use ajax.
20th Mar 2017, 9:08 AM
Animesh
Animesh - avatar