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

回答編集履歴

1

動作サンプルの追加

2021/01/13 08:01

投稿

kai0310
kai0310

スコア2076

answer CHANGED
@@ -1,6 +1,8 @@
1
1
  色々と盛大に文法エラーがあったので修正.
2
2
  動作的な部分は見ていませんがアクセスはできるはず.
3
3
 
4
+ [動作サンプル - paiza.io](https://paiza.io/projects/nNoCPp7a9P6djb_lVO3DOQ)
5
+
4
6
  ```PHP
5
7
  <?php
6
8
  ini_set( 'display_errors', 1 );
@@ -25,7 +27,7 @@
25
27
  } else {
26
28
  $email = htmlspecialchars($_POST['email']);
27
29
  }
28
- if (empty($_POST['honbun'])){
30
+ if (empty($_POST['honbun'])) {
29
31
  $error_honbun = "本文を入力してください\n";
30
32
  } else {
31
33
  $honbun = htmlspecialchars($_POST['honbun']);
@@ -86,18 +88,18 @@
86
88
  <p><?php echo nl2br($honbun); ?></p>
87
89
 
88
90
  <form action="index.php" method="post">
89
- <input type="hidden" name="mode" value="submit">
91
+ <input type="hidden" name="mode" value="submit">
90
- <input type="hidden" name="namae" value="<?php echo $namae; ?>">
92
+ <input type="hidden" name="namae" value="<?php echo $namae; ?>">
91
- <input type="hidden" name="email" value="<?php echo $email; ?>">
93
+ <input type="hidden" name="email" value="<?php echo $email; ?>">
92
- <input type="hidden" name="honbun" value="<?php echo $honbun; ?>">
94
+ <input type="hidden" name="honbun" value="<?php echo $honbun; ?>">
93
- <p><button type="submit">送信</button></p>
95
+ <p><button type="submit">送信</button></p>
94
96
  </form>
95
97
  <form action="index.php" method="post">
96
- <input type="hidden" name="mode" value="input">
98
+ <input type="hidden" name="mode" value="input">
97
- <input type="hidddn" name="namae" value="<?php echo $namae; ?>">
99
+ <input type="hidddn" name="namae" value="<?php echo $namae; ?>">
98
- <input type="hidden" name="email" value="<?php echo $email; ?>">
100
+ <input type="hidden" name="email" value="<?php echo $email; ?>">
99
- <input type="hidden" name="honbun" value="<?php echo $honbun; ?>">
101
+ <input type="hidden" name="honbun" value="<?php echo $honbun; ?>">
100
- <p><button type="submit">戻る</button></p>
102
+ <p><button type="submit">戻る</button></p>
101
103
  </form>
102
104
 
103
105
  <?php else: ?>