Is it possible to read from an input field with JS and write it into a file with PHP? Can you pass a var from one to a other? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Is it possible to read from an input field with JS and write it into a file with PHP? Can you pass a var from one to a other?

Like get an input's value with document.getElementById().value and assign a var to it, then pass it to PHP?

8th Sep 2019, 2:53 PM
Greg D
Greg D - avatar
2 Answers
+ 3
Yes, you can do that. You can send data to a php file by making an xmlhttp request or using Ajax in jQuery. The data you send can be variables that were set with input field values.
8th Sep 2019, 3:07 PM
Zeke Williams
Zeke Williams - avatar
0
Thank you
8th Sep 2019, 5:51 PM
Greg D
Greg D - avatar