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