teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

4

2019/01/13 14:04

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
@@ -1,7 +1,26 @@
1
1
  htmlのフォームから取得した文字をjsonファイルに代入したいんですがカッコを最低限の数にしたいです。どうすれば良いでしょうか。
2
2
 
3
3
  ### 該当のソースコード
4
+ ```html
5
+ <html>
6
+ <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
7
+ <title>input.html</title></head>
8
+ <body>
4
9
 
10
+ <form action="output.php" method="post">
11
+ <table border="1">
12
+ <tr>
13
+ <td><input type="text" name="message1"></td>
14
+ <td><input type="text" name="message2"></td>
15
+ <input type="submit" value="入力">
16
+ </tr>
17
+ </table>
18
+ </form>
19
+ </body>
20
+ </html>
21
+ ```
22
+
23
+
5
24
  ```PHP
6
25
  <html>
7
26
  <head><title></title></head>

3

2019/01/13 14:04

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
@@ -1,4 +1,4 @@
1
- htmlのフォームから取得した文字をjsonファイルに代入したいんですがカッコをしたいです。どうすれば良いでしょうか
1
+ htmlのフォームから取得した文字をjsonファイルに代入したいんですがカッコを最低限の数にしたいです。どうすれば良いでしょうか
2
2
 
3
3
  ### 該当のソースコード
4
4
 

2

2019/01/13 14:02

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
@@ -30,5 +30,5 @@
30
30
  ```
31
31
  理想のjson
32
32
  ```json
33
- [{"hoge":"hoge","hogehoge":"hogehoge"}]
33
+ {"hoge":"hoge","hogehoge":"hogehoge"}
34
34
  ```

1

2019/01/13 13:58

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
@@ -14,7 +14,7 @@
14
14
  $message_post2 = $_POST['message2'];
15
15
 
16
16
  $records[] = array(
17
- $message_post2 => $message_post2
17
+ $message_post1 => $message_post2
18
18
  );
19
19
 
20
20
  $out_json = json_encode($records,JSON_UNESCAPED_UNICODE);