回答編集履歴

1

追記

2022/05/11 03:59

投稿

yambejp
yambejp

スコア114843

test CHANGED
@@ -16,3 +16,22 @@
16
16
  <?PHP
17
17
  print_r(json_decode($_POST["data"]));
18
18
  ```
19
+ # 追記
20
+ json経由にしたくないならこんな感じでも
21
+ ```javascript
22
+ const data=[
23
+ ['テスト1名前', 'test1@gmail.com', '09011112222', '事務', '222', '2334'],
24
+ ['テスト2名前', 'test2@gmail.com', '09011112222', '事業開発', '', ''],
25
+ ['テスト3名前', 'test3@gmail.com', '09011112222', '営業', '123', '1234'],
26
+ ['テスト4名前', 'test4@gmail.com', '09011112222', '開発', '', ''],
27
+ ['テスト5namae', '', '', '', '', '']
28
+ ];
29
+ const body=new FormData();
30
+ data.forEach((x,i)=>x.forEach(y=>{body.append(`data[${i}][]`,y);}))
31
+ fetch('sample.php',{method:"post",body}).then(res=>res.text()).then(console.log);
32
+ ```
33
+ //sample.php
34
+ ```PHP
35
+ <?PHP
36
+ print_r($_POST);
37
+ ```