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

回答編集履歴

3

追記

2019/08/20 03:43

投稿

m.ts10806
m.ts10806

スコア80888

answer CHANGED
@@ -9,4 +9,26 @@
9
9
  print'<input type="button" onclick="history.back()" value="戻る">';
10
10
  print'<input type="submit" value="OK">';
11
11
  print"</form>";
12
+ ```
13
+
14
+ あとは「フラグ制御」としたいのであればボタン出力の分岐に同じ式を入れるのではなく、
15
+ デフォルトfalseとしたフラグをそれぞれの入力チェックの時にtrueにしてそのフラグだけ見れば良いです。そのほうがスッキリします。
16
+
17
+ ```php
18
+ $error = false;
19
+ if($a==''){
20
+ $error = true;
21
+ }else{
22
+ }
23
+
24
+ if($b==''){
25
+ $error = true;
26
+ }else{
27
+ }
28
+
29
+ if($error){
30
+ //入力エラーあるよ
31
+ }else{
32
+ //入力ーないよ
33
+ }
12
34
  ```

2

作りかけのものでとりあえず直面してる問題を解決したいとのことで冗長な指摘を削除

2019/08/20 03:43

投稿

m.ts10806
m.ts10806

スコア80888

answer CHANGED
@@ -8,6 +8,5 @@
8
8
  print'<form method="post" action="thanks.php">';
9
9
  print'<input type="button" onclick="history.back()" value="戻る">';
10
10
  print'<input type="submit" value="OK">';
11
- //formの中にボタンしかないからthanks.phpにはボタンしか送信されないけどそれでもいいの?
12
11
  print"</form>";
13
12
  ```

1

修正

2019/08/20 03:30

投稿

m.ts10806
m.ts10806

スコア80888

answer CHANGED
@@ -8,5 +8,6 @@
8
8
  print'<form method="post" action="thanks.php">';
9
9
  print'<input type="button" onclick="history.back()" value="戻る">';
10
10
  print'<input type="submit" value="OK">';
11
+ //formの中にボタンしかないからthanks.phpにはボタンしか送信されないけどそれでもいいの?
11
12
  print"</form>";
12
13
  ```