How do I Batch input data and execute it? Dear friends, this is the case. I want to pass several pieces of data to adc. php one by one for execution. I know that the following code can be used to transmit a group of data. But what if I want to pass many groups without manual input in one group?
Script
$ (Document). ready (function (){
$ ("# Submit"). click (function (){
Var name = $ ("# name"). val ();
Var scores = $ ("# scores"). val ();
Location. href = "adc. php? Name = "+ name +" & scores = "+ scores;
}
Script
For example, if the following five groups of data are input five times separately, the above program is acceptable. however, is it possible for me to paste the following table into the text box at a time, and then the program will automatically identify and execute the data in groups one by one? Thank you.
Wang 100
Xiao Zhang 121
Liu 541
Zhang San 555
Li Si 410
Reply to discussion (solution)
The idea should be that the array json is passed to receive and parse the foreach loop
Yes. you can output all the names in a box and pass them directly to php with a uniform separator. then, you can use the string. splite () command on the front end.
For example, you entered: Xiao Wang 100 Xiao Zhang 121 Xiao Liu 541 Zhang San 555 Li Si 410 are separated by empty spaces.
Frontend processing
Var str = 'Wang 100 Xiao Zhang 121 Xiao Liu 541 Zhang San 555 Li Si 410 '; var data = str. splite (""); var urlparam = "? A = 1 "; // it is useless to pass multiple parameters to keep the data format convenient for the following loop (var I = 0; I
The backend obtains an array of names and scores.
Or you can directly pass it to the background
? Data = Xiao Wang 100 Xiao Zhang 121 Xiao Liu 541 Zhang San 555 Li Si 410
In the background, The explode () can also be cyclically based on the method similar to the above.
You can use textarea to save a row of users.
Then, PHP will explain it according to the line feed.
For example:
Html
Submit
Server. php
$name, 'score' => $score ); }}print_r($result);?>
In textarea, enter
Wang, 100
Zhang, 121
Liu, 541
Michael Zhang, 555
Li Si, 410
After submission, PHP obtains
Array ([0] => Array ([name] => John [score] => 100) [1] => Array ([name] => Xiao Zhang [score] => 121) [2] => Array ([name] => Xiao Liu [score] => 541) [3] => Array ([name] => Zhang San [score] => 555) [4] => Array ([name] => Li Si [score] => 410 ))
Thank you for your ideas and methods. I have not learned all about them, but I have learned about the second floor. Thank you.