11
13

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

PHP フォームに入力された値の取得

Last updated at Posted at 2013-03-05

フォームに入力された値のPHPによる取得方法について解説します。
##フォームの作成
formタグのmethod属性に"post"を指定し、action属性に送信先のPHPファイルのURLを指定します。

form.html
<form action="action.php" method="post">
  <label for="text1">テキスト: </label>
  <input type="text" name="text1">
  <input type="submit" name="send" value="送信">
</form>

##フォームの取得
$_POST['text1']でname属性に"text1"を指定したinput要素の値を取得できます。

action.php
<?php
	echo($_POST['text1']);
?>
11
13
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
11
13

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?