I have a script that allows me to dynamically create lists via jQuery. I’d like to create an .html file in a specific directory, then store that list in the file.
Thus: “A \n B \n C \n D …”
var dName = $(".C_D_Input input").val().trim();
var location = "file:///Volumes/EXT/Lists/" + dName + "/";
var words = $(".Input_Field").val().split(/\n/g);
$("#List_" + User).html("");
for (i = 0; words.length > i; i++) {
$("#List_" + User).append('<span>' + location + words[i].trim() + '</span>');
};
Becomes:
<span>file:///Volumes/EXT/Lists/XXX/A</span>
<span>file:///Volumes/EXT/Lists/XXX/B</span>
<span>file:///Volumes/EXT/Lists/XXX/C</span>
<span>file:///Volumes/EXT/Lists/XXX/D</span>
...
Then the php would export the above to a new .html file. It may look strange, but I need it like that.
I’ve never scripted anything in php before, I’ve only fiddled with existing scripts. I understand the syntax, but not the necessary set up for running php scripts.
Any help/pointers would be appreciated.
Post the results of your jQuery via an HTML form to your PHP script that does the file creation and saving. There are plenty of tutorials that show how to create and write files in PHP.