送信側
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>questionaire06</title>
<style>
table, th, td{
border: 1px solid #AAA;
border-collapse: collapse;
}
</style>
</head><body>
<form action="getquestionaire06.php" method="post">
<table>
<tr>
<th>お名前</th><td><input type="text" name="your_name" ></td>
</tr>
<tr>
<th>メールアドレス</th><td><input type="email" name="mailAdress"></td>
</tr>
<tr>
<th>コメント欄</th><td><textarea name="comment" rows="5" cols="40"></textarea></td>
</tr>
</table>
<p><input type="submit" value="送信する"></p>
</form>
</body>
</html>
受信側
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>post questionaire06</title>
</head><body>
<?php
$your_name=$_POST['your_name'];
$mailAdress=$_POST['mailAdress'];
$comment=$_POST['comment'];
echo '<p>あなたのお名前は'.$your_name.'ですね。<br/>メールアドレスをご確認ください。'.$mailAdress.'</p>';
echo '<p>入力内容をご確認ください。'.$comment.'</p>';
?>
</body>
</html>
- input type="email"は入力された形式がメールアドレスとしてそぐわない時にエラー表示する。