タイトル: $_POST
この本文には実行可能なタグ等が含まれるため、安全のためHTMLソースとして表示しています。本文データは変更していません。
<p>クライアント→サーバへのデータ送信方法の一つ。</p>
<p>以下、HTMLフォームを送信する方法を記載する。</p>
<p>HTMLのformタグ(method属性で”<span style="color:#e74c3c">POST</span>”指定)内のaction属性で、受信側のファイルを指定する。</p>
<p>受信側のファイルでは <span style="color:#e74c3c">$_POST[‘name属性名'] </span>で送信データを受け取る。</p>
<p>以下、実装例。</p>
<p>【例】</p>
<p style="margin-left:40px">『注文画面』</p>
<p style="margin-left:80px"><img alt="" src="/uploadImage/20170809014116_2945120.jpg" /></p>
<p style="margin-left:80px"><html></p>
<p style="margin-left:80px"> <body></p>
<p style="margin-left:80px"> <!-- フォーム通信を実行する --></p>
<p style="margin-left:80px"> <strong><span style="color:#e74c3c"><form method="POST" action="TestPost.php"></span></strong></p>
<p style="margin-left:80px"> <input type="text" <span style="color:#e74c3c">name="item"</span>></p>
<p style="margin-left:80px"> <input type="submit" value="注文する"></p>
<p style="margin-left:80px"> <span style="color:#e74c3c"><strong></form></strong></span></p>
<p style="margin-left:80px"> </body></p>
<p style="margin-left:80px"></html></p>
<p style="margin-left:80px"> </p>
<p style="margin-left:40px">『注文完了画面』</p>
<p style="margin-left:80px"><img alt="" src="/uploadImage/20170809014405_4709410.jpg" /></p>
<p style="margin-left:80px"><html></p>
<p style="margin-left:80px"> <body></p>
<p style="margin-left:80px"> <?=<strong><span style="color:#e74c3c">$_POST['item']</span></strong> ?>の注文を承りました。</p>
<p style="margin-left:80px"> </body></p>
<p style="margin-left:80px"></html></p>