jquery - Create and Post an Array[ Array[] ] to PHP - fputcsv() -
I am struggling with it ...
To create me posted on a php page The problem is a CSV file is this, I can not understand how to create a proper array and then post it to php to process it.
My php page has a function that repeats through the posted value and writes in CSV.
Function Output CSC ($ data) {$ Output = FOPN ("php: // output", "w"); Forex Currency ($ data as $ line) {fputcsv ($ output, $ line); } Fclose ($ output); }
I'm getting Then the function is running ... When I post, I get an error I know That's something to do with my origin in the original (posts from the page) page, or how am I sending it. How should the array be formatted here (which works if I set it to php page then run the function) Now, from my post-page, I am looping through some values and a variable For me, it looks correct, but I'm most likely to lose this variable for processing correctly on the PRP page It's been a tough time. I have tried several things, such as setting the input value variable, then posting. I have jquery's Plus a bunch of other methods, however, I am wasting my time only to list them out as I think the above two methods should work and I remember a few simple ones. Can do. Sometimes I get an incomplete result (like just one array) with PHP's I am very worried that any help or guidance will be highly appreciated. Thank you in advance! Extra If I do Internal arrays $ data via a post like this ...
$ csvdata = $ _POST ['csvData'];
Output CSV ($ csvData);
Warning: Invalid argument for foreach ()
Output CSV (" Array ("name 3", "age 3", "city 3"), array ("name 2", "age 2", "city 2"), array ("name 1", "age 1", "city 1"), array ));
var newData = [];
in which the array is array with the value as the value, when I print in the console, I get it ...
array [aa [3] ], Array [3], array [3]]
& lt; Input id = "csv" name = "csvdata []" /> $ ('# CSV') val (newData)
$ Tried to use like post
$ Post ("csvsave.php", {CsvData ': newData});
print_r
, I get all the values in the CSV but in just one line, but this Always throws an error. I have been mentioned above, and sometimes writes the error on the CSV page. var_dump
at the post value, then I get it
Array (1) {[0] = & gt; String (59) "Name 1, Age 1, City 1, Name 2, Age 2, City 2, Name 3, Age 3, City 3"}
Comments
Post a Comment