LoginSignup
0
0

More than 3 years have passed since last update.

フォーム作成②

Posted at

フォームで送信した値を確認するために作った物。今回はtableタグを使ったけどしっくり来ない感がある。とは言え他にどのように表記させるか考えても思い浮かばなかったので、現時点ではこれでいいだろう。

学んだこと
$_POST[name属性に指定した値];
これを使ってフォームに入れた値を表示させる

課題
method属性のgetとpostの違いを学ぶこと。


<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="content-type" content ="text/html"  charset="utf-8"/>
  <title>ゲーム作品感想フォーム</title>
</head>

<body>
  <h2>好きなゲーム作品感想投稿サイト</h2>
  <form action ="formTest2.php" method ="post">


<table border ='1'>
  <tr>
    <td>名前</td>
 <td><?php echo $_POST['name'] ?></td>
</tr>
<tr>
  <td>メールアドレス</td>
 <td><?php echo $_POST['mail']?></td>
</tr>
<tr>
  <td>性別</td>
 <td><?php echo $_POST['sex']?></td>
</tr>
<tr>
  <td>ハード</td>
  <td><?php echo $_POST['checkbox']?></td>
</tr>
<tr>
  <td>作品名</td>
 <td><?php echo $_POST['title']?></td>
</tr>
<tr>
  <td>ゲームの感想</td>
 <td><?php echo $_POST['review']?></td>
</tr>
</table>

<input type ="submit" value ="送信">
</form>
</body>
</html>
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0