2009.04.13

Webプログラミングを少し理解してみよう~アカウント作成・ログイン編~

イメージ:Webプログラミングを少し理解してみよう~アカウント作成・ログイン編~

Saity先生のPHP講座<超初級編> ♯3
Saity(アシアル)

バックナンバー

こんにちは、Saityです。
ファンの皆さまもお待たせしました(笑) 少々忙しくしており、ややご無沙汰気味でした。今回は、みなさんに少しだけWebプログラミングの世界をのお話をしたいと思います。

プログラミングと言っても、難しい部分は置いておきましょう。PHPを使った分かりやすくかつお仕事に有利になるようなプログラミングをここでは紹介していきます。

アカウント登録による、IDとパスワード登録のHTML

多くのWebアプリケーションの事始めとして、アプリケーションを利用するためのアカウント登録による、IDとパスワードの登録を行います。下の画像のような画面をよく見かけると思います。

アカウント登録画面
アカウント登録によるID、パスワードの登録画面

このIDとパスワードを入力することによってアプリケーション内へとログインしていくわけです。それでは初めに、アカウント登録プログラムを見て行きましょう。

アカウント登録の画面を表示させるために、HTMLを以下のように記述したとします。

<form action="register.php" method="post">
お名前<input type="text" name="name" /><br />
E-mail<input type="text" name="email" /><br />
パスワード<input type="password" name="pw1" /><br />
パスワード確認<input type="password" name="pw2" /><br />
性別<input type="radio" name="sex" value="1" checked="checked" />男
  <input type="radio" name="sex" value="2" />女<br />
<input type="submit" name="verify" value="確認" />
</form>

<input>タグを使った入力内容を送信するためには、まとまった入力フォームを<form>タグで括る必要があります。また、<form>タグの中には必ず一つ以上の送信ボタン<input type="submit">(もしくは画像を使う場合は、<input type="image">)が用意されます。利用者による入力が行われ送信ボタンが押されると、<form>タグ内のaction属性とmethod属性の値に従って入力内容が送信されるのです。

actionには入力内容の送信先URLが記述されます。例にあげたように、ドメイン名やディレクトリ名の指定が省略されているものは、<a>タグや<img>タグ指定時のhref属性に指定するファイル名と同じように、このHTMLを呼び出したドメイン・ディレクトリと同じ階層に存在し、省略が可能です。

次のページでは、methodの「post」と「get」の違いについて紹介します。

1 2 3

このエントリーをブックマークする

このエントリーにトラックバックする

このエントリーのトラックバックURL
http://withd.jp/mt/mt-tb.cgi/3607



Warning: mysql_connect() [function.mysql-connect]: Can't create a new thread (errno 12); if you are not out of available memory, you can consult the manual for a possible OS-dependent bug in /home/withd/www/banner/medium_web.html on line 10

Warning: mysql_select_db() [function.mysql-select-db]: Can't create a new thread (errno 12); if you are not out of available memory, you can consult the manual for a possible OS-dependent bug in /home/withd/www/banner/medium_web.html on line 11

Warning: mysql_select_db() [function.mysql-select-db]: A link to the server could not be established in /home/withd/www/banner/medium_web.html on line 11

クリ博就職フェスタ大阪 キックオフ! 2009年10月27日~-28日


Warning: mysql_query() [function.mysql-query]: Can't create a new thread (errno 12); if you are not out of available memory, you can consult the manual for a possible OS-dependent bug in /home/withd/www/banner/medium_web.html on line 55

Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home/withd/www/banner/medium_web.html on line 55



Warning: mysql_connect() [function.mysql-connect]: Can't create a new thread (errno 12); if you are not out of available memory, you can consult the manual for a possible OS-dependent bug in /home/withd/www/banner/original_web.html on line 10

Warning: mysql_select_db() [function.mysql-select-db]: Can't create a new thread (errno 12); if you are not out of available memory, you can consult the manual for a possible OS-dependent bug in /home/withd/www/banner/original_web.html on line 11

Warning: mysql_select_db() [function.mysql-select-db]: A link to the server could not be established in /home/withd/www/banner/original_web.html on line 11

Warning: mysql_query() [function.mysql-query]: Can't create a new thread (errno 12); if you are not out of available memory, you can consult the manual for a possible OS-dependent bug in /home/withd/www/banner/original_web.html on line 75

Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home/withd/www/banner/original_web.html on line 75

Warning: mysql_query() [function.mysql-query]: Can't create a new thread (errno 12); if you are not out of available memory, you can consult the manual for a possible OS-dependent bug in /home/withd/www/banner/original_web.html on line 75

Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home/withd/www/banner/original_web.html on line 75

Warning: mysql_query() [function.mysql-query]: Can't create a new thread (errno 12); if you are not out of available memory, you can consult the manual for a possible OS-dependent bug in /home/withd/www/banner/original_web.html on line 75

Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home/withd/www/banner/original_web.html on line 75

Warning: mysql_query() [function.mysql-query]: Can't create a new thread (errno 12); if you are not out of available memory, you can consult the manual for a possible OS-dependent bug in /home/withd/www/banner/original_web.html on line 75

Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home/withd/www/banner/original_web.html on line 75