| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
| <!-- |
| Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. |
| --> |
| <html> |
| <head> |
| <title>PHPを使用するデータベース駆動型アプリケーションの作成MySQLデータベースにレコードを作成するPHP実装</title> |
| <meta http-equiv="content-type" content="text/html; charset=UTF-8"> |
| <meta name="KEYWORDS" content="CRUD, Update, Delete, MySQL, PHP, NetBeans"> |
| <meta name="DESCRIPTION" content="Creating a Database Driven Application With PHP. PHP implementation of creating a new record in MySQL database" > |
| <link rel="stylesheet" type="text/css" href="../../../netbeans.css" media="screen"> |
| </head> |
| <body> |
| <h1>PHPを使用するデータベース駆動型アプリケーションの作成 </h1> |
| <h1>レッスン3: 新規アプリケーション・ユーザーの作成 </h1> |
| <div style="margin-left:-3px"> |
| <div class="feedback-box margin-around float-left" style="margin-right:15px"> |
| <h4>チュートリアルの目次:</h4> |
| <ol start="0"> |
| <li><a href="wish-list-tutorial-main-page.html">PHPを使用するデータベース駆動型アプリケーションの作成 - メイン・ページ</a></li> |
| <li><p>データベースの作成</p> <ol type="a"><li><a href="wish-list-lesson1.html">MySQLデータベースの作成</a></li> |
| <li><a href="wish-list-oracle-lesson1.html">Oracleデータベース表の作成</a></li> |
| </ol></li> |
| <li> |
| <p><a href="wish-list-lesson2.html">アプリケーションの設計。データベースからの読取り</a></p> |
| </li> |
| <li><p><b>=> 新規アプリケーション・ユーザーの作成</b></p> |
| <ul> |
| <li><a href="#previousLessonSourceCode">前のレッスンからのアプリケーション・ソース・コード</a></li> |
| <li><a href="#addLinkNewWisher">新規ウィッシャの作成を開始するリンクの追加</a></li> |
| <li><a href="#implementCreateNewWisher">新規PHP Webページの作成</a> |
| <li><a href="#inputFormNewWisher">新規ウィッシャのデータを入力するためのHTMLフォームの追加</a></li> |
| <li><a href="#validatinDataBeforeAddingToDatabase">データの検証とデータベースへの追加</a></li> |
| <li><a href="#errorMessagesInInputForm">入力フォームでのエラー・メッセージの表示</a></li> |
| <li><a href="#testCreateNewWisherFunctionality">新規ウィッシャの作成機能のテスト</a></li> |
| |
| |
| <li><a href="#lessonResultSourceCode">現在のレッスン完了後のアプリケーション・ソース・コード</a></li> |
| </ul> |
| </li> |
| <li><a href="wish-list-lesson4.html">コードの最適化</a></li> |
| <li><a href="wish-list-lesson5.html">セキュリティの追加。アプリケーション・ユーザー・ログオンの実装</a></li> |
| <li><a href="wish-list-lesson6.html">データベースへの新しいウィッシュの追加</a></li> |
| <li><a href="wish-list-lesson7.html">データベース内のエントリの更新および削除</a></li> |
| <li><a href="wish-list-lesson8.html">CSSテクノロジを使用したアプリケーションの外観の改良</a></li> |
| <li><a href="wish-list-lesson9.html">リモートWebサーバーへのアプリケーションのデプロイ</a></li> |
| </ol> |
| </div> |
| </div> |
| <img alt="このページの内容は、NetBeans IDE 7.2、7.3、7.4および8.0に適用されます" class="stamp" src="../../../images_www/articles/73/netbeans-stamp-80-74-73.png" title="このページの内容は、NetBeans IDE 7.2、7.3、7.4および8.0に適用されます"> |
| |
| <p>このレッスンでは、新規ウィッシャの作成機能を使用してアプリケーションを拡張します。 </p> |
| <p>この実装はindex.phpファイルに影響し、<tt>createNewWisher.php</tt>および<tt>editWishList.php</tt>という名前の2つの新しいファイルが作成されます。</p> |
| <p>新規ウィッシャの作成のユース・ケースは、3つのステップで構成されます。</p> |
| <p>1. <a href="#addLinkNewWisher">ユーザーが最初のページindex.phpを開き、リンクをクリックして登録する</a>。</p> |
| <p>2. <a href="#implementCreateNewWisher">ユーザーが、新しいウィッシャを作成するためにcreateNewWisher.phpページに切り替える</a>。 </p> |
| <p>3. 新しいウィッシャを作成した後、ユーザーはeditWishList.phpに切り替え、ユーザーのウィッシュ・リストを作成する。</p> |
| <img alt="レッスン3で作成される新しいファイルを強調表示したページ・フロー図" class="margin-around" src="../../../images_www/articles/72/php/oracle-wishlist/page-flow-diagram-l3.png"> |
| <p>現在のドキュメントは、PHP向けのNetBeans IDEでのデータベース・アプリケーションの作成というチュートリアルの一部です。 </p> |
| <br style="clear:left"> |
| |
| |
| <h2><a name="previousLessonSourceCode"></a>前のレッスンからのアプリケーション・ソース・コード</h2> |
| <p>MySQLユーザー: 前のレッスンが完了した後のプロジェクトの状態を反映したソース・コードをダウンロードするには、<a href="https://netbeans.org/files/documents/4/1928/lesson2.zip" target="_blank">ここ</a>をクリックします。 </p> |
| <p>Oracleデータベース・ユーザー: 前のレッスンが完了した後のプロジェクトの状態を反映したソース・コードをダウンロードするには、<a href="https://netbeans.org/projects/www/downloads/download/php%252Foracle-lesson2.zip" target="_blank">ここ</a>をクリックします。</p> |
| <h2><a id="addLinkNewWisher" name="addLinkNewWisher"></a>新規ウィッシャの作成を開始するリンクの追加 </h2> |
| <tt>index.php</tt>を開きます。終了の</form>タグの下に空白行を追加します。その空白行に、次のコード・ブロックを入力します。 |
| <pre class="examplecode"> <br>Still don't have a wish list?! <a href="createNewWisher.php">Create now</a></pre> |
| <p>ここでは次のようになっています。</p> |
| <ul> |
| <li><tt>Still don't have a wish list?!</tt>は、リンクの横のページ上に表示されるテキストです。 </li> |
| <li><tt><a href="createNewWisher.php"></a></tt>は、createNewWisher.phpページを開くリンクを実装するコードです。 |
| </li> |
| <li><tt>Create now</tt>は、リンクとして表示されるテキストです。 |
| </li> |
| </ul> |
| <h2><a id="implementCreateNewWisher" name="implementCreateNewWisher"></a>新規PHP Webページの作成</h2> |
| <p>レッスン2の<a href="wish-list-lesson2.html#createNewFile">説明</a>に従い、プロジェクトのソース・ファイルに新しいPHP Webページを2つ作成します。</p> |
| <ul> |
| <li><tt>createNewWisher.php</tt></li> |
| <li><tt>editWishList.php</tt></li> |
| </ul> |
| <p><tt>editWishList.php</tt>に、「Hello!」というテキストをHTMLの本体に追加し、その他の部分はデフォルトの内容のままにします。このファイルは後のレッスンで変更しますが、<tt>createNewWisher.php</tt>がこのファイルを参照するため、ここでは存在する必要があります。このレッスンでは、<tt>createNewWisher.php</tt>を変更します。</p> |
| |
| <h2><a id="inputFormNewWisher" name="inputFormNewWisher"></a>新規ウィッシャのデータを入力するためのHTMLフォームの追加 </h2> |
| <p>次のHTMLブロックを、<tt>createNewWisher.php</tt>のPHPブロックの下に入力するか、または貼り付けます。</p> |
| <pre class="examplecode"><html> |
| <head> |
| <meta http-equiv="content-type" content="text/html; charset=UTF-8"> |
| <title></title> |
| </head> |
| <body><br> Welcome!<br><br> <form action="createNewWisher.php" method="POST"><br> Your name: <input type="text" name="user"/><br/><br> Password: <input type="password" name="password"/><br/><br> Please confirm your password: <input type="password" name="password2"/><br/><br> <input type="submit" value="Register"/><br> </form><br> </body> |
| </html></pre> |
| <p class="notes"><strong>注意:</strong> <tt>password</tt>型は、文字がアスタリスクに置き換えられる、特殊なテキスト・フィールドの型です。コードは、ユーザーが新しいウィッシャの名前とパスワードをテキスト・フィールドに入力するための<a href="wish-list-lesson3.html#htmlForm">HTMLフォーム</a>を示します。ユーザーが「Register」ボタンをクリックすると、入力したデータが、検証のために同じページ<tt>createNewWisher.php</tt>に転送されます。</p> |
| <p class="notes"><b>注意: </b>HTMLバリデータからの警告は無視できます。</p> |
| |
| <h3><a id="validatinDataBeforeAddingToDatabase" name="validatinDataBeforeAddingToDatabase"></a>データの検証とデータベースへの追加 </h3> |
| <p>この項では、<tt>createNewWisher.php</tt>にPHPコードを追加します。このコードを、ファイルの先頭にあるPHPブロックに追加します。PHPブロックは、<strong>すべての</strong>HTMLコード、空白行、または空白の上にある必要があります。PHPコード・ブロックの位置は、リダイレクト文を正しく機能させるために重要です。PHPブロックの内部に、この項に示す次のコード・ブロックを記述されている順序で入力するか、または貼り付けます。</p> |
| <p><strong>次のコードを追加し、データを検証します。</strong></p> |
| <ol> |
| <li>変数を初期化します。最初の変数はデータベースの証明書を渡し、その他はPHP操作で使用される変数です。 <pre class="examplecode"> |
| /** database connection credentials */<br>$dbHost="localhost"; //on MySql |
| $dbXeHost="localhost/XE"; <br>$dbUsername="phpuser";<br>$dbPassword="phpuserpw"; |
| |
| /** other variables */ |
| $userNameIsUnique = true; |
| $passwordIsValid = true; |
| $userIsEmpty = false; |
| $passwordIsEmpty = false; |
| $password2IsEmpty = false; |
| |
| </pre> |
| </li> |
| <li>変数の下に<tt>if</tt>節を追加します。<tt>if</tt>節のパラメータは、ページがPOSTメソッド経由で同じページからリクエストされたことを確認します。そうでない場合、それ以上の検証は実行されず、ページは前述のように空のフィールドで表示されます。 |
| <pre class="examplecode">/** Check that the page was requested from itself via the POST method. */ |
| if ($_SERVER["REQUEST_METHOD"] == "POST") { |
| |
| }</pre> |
| </li> |
| <li><tt>if</tt>節の中括弧内に、ユーザーがウィッシャの名前を入力したかどうかを確認するための別の<tt>if</tt>節を追加します。テキスト・フィールド「user」が空の場合は、<tt>$userIsEmpty</tt>の値がtrueに変わります。 <pre class="examplecode">/** Check that the page was requested from itself via the POST method. */ |
| if ($_SERVER["REQUEST_METHOD"] == "POST") { |
| |
| /** Check whether the user has filled in the wisher's name in the text field "user" */ <strong> |
| if ($_POST["user"]=="") { |
| $userIsEmpty = true; |
| }</strong> |
| }</pre> |
| </li> |
| <li><p>データベース接続を確立するコードを追加します。接続が確立できない場合、MySQLまたはOracle OCI8エラーが出力に送信されます。</p> |
| <p><b>MySQLデータベースの場合:</b></p> |
| <pre class="examplecode">/** Check that the page was requested from itself via the POST method. */ |
| if ($_SERVER["REQUEST_METHOD"] == "POST") { |
| |
| /** Check whether the user has filled in the wisher's name in the text field "user" */ |
| if ($_POST["user"]=="") { |
| $userIsEmpty = true; |
| } |
| |
| /** Create database connection */<br> |
| <strong>$con = mysqli_connect($dbHost, $dbUsername, $dbPassword);<br> if (!$con) {<br> exit('Connect Error (' . mysqli_connect_errno() . ') '<br> . mysqli_connect_error());<br> }<br>//set the default client character set <br> mysqli_set_charset($con, 'utf-8');</strong> |
| } </pre> |
| <p><b>Oracleデータベースの場合:</b></p> |
| <pre class="examplecode"> |
| /** Check that the page was requested from itself via the POST method. */ |
| if ($_SERVER['REQUEST_METHOD'] == "POST") { |
| |
| /** Check whether the user has filled in the wisher's name in the text field "user" */ |
| if ($_POST['user'] == "") { |
| $userIsEmpty = true; |
| } |
| |
| /** Create database connection */<br> |
| <strong>$con = oci_connect($dbUsername, $dbPassword, $dbXeHost, "AL32UTF8"); |
| if (!$con) { |
| $m = oci_error(); |
| exit('Connect Error' . $m['message']); |
| |
| }</strong> |
| }</pre> |
| </li> |
| <li>「user」フィールドと名前が一致するユーザーが、すでに存在するかどうかを確認するコードを追加します。このコードは、「user」フィールド内の名前と一致する名前のウィッシャID番号の検索することによって、これを実行します。そのようなID番号が存在する場合、<tt>$userNameIsUnique</tt>の値は「false」に変更されます。 |
| <p><b>MySQLデータベースの場合:</b></p> |
| <pre class="examplecode">/** Check that the page was requested from itself via the POST method. */ |
| if ($_SERVER["REQUEST_METHOD"] == "POST") { |
| |
| /** Check whether the user has filled in the wisher's name in the text field "user" */ |
| |
| if ($_POST["user"]=="") { |
| $userIsEmpty = true; |
| }<br> |
| |
| /** Create database connection */<br> $con = mysqli_connect($dbHost, $dbUsername, $dbPassword);<br> if (!$con) {<br> exit('Connect Error (' . mysqli_connect_errno() . ') '<br> . mysqli_connect_error());<br> }<br> <strong>/**set the default client character set */ <br> mysqli_set_charset($con, 'utf-8');</strong> |
| <strong>/** Check whether a user whose name matches the "user" field already exists */</strong><br> |
| <strong>mysqli_select_db($con, "wishlist"); |
| $user = mysqli_real_escape_string($con, $_POST["user"]);<br> $wisher = mysqli_query($con, "SELECT id FROM wishers WHERE name='".$user."'");<br> $wisherIDnum=mysqli_num_rows($wisher);<br> if ($wisherIDnum) {<br> $userNameIsUnique = false;<br> }</strong> |
| } </pre> |
| <p><b>Oracleデータベースの場合:</b></p> |
| <pre class="examplecode">/** Check that the page was requested from itself via the POST method. */ |
| if ($_SERVER['REQUEST_METHOD'] == "POST") { |
| /** Check whether the user has filled in the wisher's name in the text field "user" */ |
| if ($_POST['user'] == "") { |
| $userIsEmpty = true; |
| } |
| /** Create database connection */<br> |
| $con = oci_connect($dbUsername, $dbPassword, $dbXeHost, "AL32UTF8"); |
| if (!$con) { |
| $m = oci_error(); |
| exit('Connection Error ' . $m['message']); |
| |
| } |
| |
| <strong>/** Check whether a user whose name matches the "user" field already exists */</strong> |
| <strong>$query = "SELECT id FROM wishers WHERE name = :user_bv"; |
| $stid = oci_parse($con, $query); |
| $user = $_POST['user']; |
| $wisherID = null; |
| oci_bind_by_name($stid, ':user_bv', $user); |
| oci_execute($stid); |
| |
| // Each user name should be unique. Check if the submitted user already exists. |
| $row = oci_fetch_array($stid, OCI_ASSOC); |
| if ($row){ |
| $userNameIsUnique = false; |
| }</strong> |
| }</pre> |
| </li> |
| <li>ユーザーが一意かどうかを確認するコードの後に、ユーザーがパスワードを正しく入力して確認入力したかどうかを確認する一連の<tt>if</tt>節を追加します。コードは、フォーム内の「Password」("password")および「Confirm Password」('password2)の各フィールドが空でなく、同一であることを確認します。そうでない場合は、それに応じて対応するブール型変数の値が変わります。 |
| <pre class="examplecode">if ($_POST["password"]=="") {<br> $passwordIsEmpty = true; |
| }<br>if ($_POST["password2"]=="") {<br> $password2IsEmpty = true; |
| }<br>if ($_POST["password"]!=$_POST["password2"]) {<br> $passwordIsValid = false; |
| } </pre> |
| </li> |
| <li> |
| <p>「wishers」データベースに新しいエントリを挿入するコードを追加して、<tt>if ($_SERVER['REQUEST_METHOD']=="POST")</tt>節を完成させます。コードは、ウィッシャの名前が一意に指定されていること、およびパスワードが有効に入力および確認されていることを確認します。条件を満たす場合、コードはHTMLフォームから「user」と「password」の値を取り、wishersデータベース内の新しい行のName列とPassword列にそれぞれ挿入します。行を作成した後、コードはデータベース接続を切断し、アプリケーションをページ<tt>editWishList.php</tt>にリダイレクトします。</p> |
| <p><b>MySQLデータベースの場合:</b></p> |
| <pre class="examplecode">/** Check that the page was requested from itself via the POST method. */ |
| if ($_SERVER['REQUEST_METHOD'] == "POST") { |
| /** Check whether the user has filled in the wisher's name in the text field "user" */ |
| if ($_POST['user'] == "") { |
| $userIsEmpty = true; |
| } |
| |
| /** Create database connection */ |
| $con = mysqli_connect($dbHost, $dbUsername, $dbPassword); |
| if (!$con) { |
| exit('Connect Error (' . mysqli_connect_errno() . ') ' |
| . mysqli_connect_error()); |
| } |
| //set the default client character set |
| mysqli_set_charset($con, 'utf-8'); |
| |
| /** Check whether a user whose name matches the "user" field already exists */ |
| mysqli_select_db($con, "wishlist"); |
| $user = mysqli_real_escape_string($con, $_POST['user']); |
| $wisher = mysqli_query($con, "SELECT id FROM wishers WHERE name='".$user."'"); |
| $wisherIDnum=mysqli_num_rows($wisher); |
| if ($wisherIDnum) { |
| $userNameIsUnique = false; |
| } |
| |
| /** Check whether a password was entered and confirmed correctly */ |
| if ($_POST['password'] == "") { |
| $passwordIsEmpty = true; |
| } |
| if ($_POST['password2'] == "") { |
| $password2IsEmpty = true; |
| } |
| if ($_POST['password'] != $_POST['password2']) { |
| $passwordIsValid = false; |
| } |
| |
| /** Check whether the boolean values show that the input data was validated successfully. |
| * If the data was validated successfully, add it as a new entry in the "wishers" database. |
| * After adding the new entry, close the connection and redirect the application to editWishList.php. |
| */ |
| <strong>if (!$userIsEmpty && $userNameIsUnique && !$passwordIsEmpty && !$password2IsEmpty && $passwordIsValid) { |
| $password = mysqli_real_escape_string($con, $_POST['password']); |
| mysqli_select_db($con, "wishlist"); |
| mysqli_query($con, "INSERT wishers (name, password) VALUES ('" . $user . "', '" . $password . "')"); |
| mysqli_free_result($wisher); |
| mysqli_close($con); |
| header('Location: editWishList.php'); |
| exit; |
| }</strong> |
| }</pre> |
| <p><b>Oracleデータベースの場合:</b></p> |
| <pre class="examplecode">/** Check that the page was requested from itself via the POST method. */ |
| if ($_SERVER['REQUEST_METHOD'] == "POST") { |
| |
| /** Check whether the user has filled in the wisher's name in the text field "user" */ |
| if ($_POST['user'] == "") |
| $userIsEmpty = true; |
| |
| /** Create database connection */ |
| $con = oci_connect($dbUsername, $dbPassword, $dbXeHost, "AL32UTF8"); |
| if (!$con) { |
| $m = oci_error(); |
| echo $m['message'], "\n"; |
| exit; |
| } |
| |
| /** Check whether a user whose name matches the "user" field already exists */ |
| $query = "select ID from wishers where name = :user_bv"; |
| $stid = oci_parse($con, $query); |
| $user = $_POST['user']; |
| $wisherID = null; |
| oci_bind_by_name($stid, ':user_bv', $user); |
| oci_execute($stid); |
| |
| /**Each user name should be unique. Check if the submitted user already exists. */ |
| $row = oci_fetch_array($stid, OCI_ASSOC); |
| if ($row) { |
| $wisherID = $row['ID']; |
| } |
| if ($wisherID != null) { |
| $userNameIsUnique = false; |
| } |
| //Check for the existence and validity of the password |
| if ($_POST['password'] == "") { |
| $passwordIsEmpty = true; |
| } |
| if ($_POST['password2'] == "") { |
| $password2IsEmpty = true; |
| } |
| if ($_POST['password'] != $_POST['password2']) { |
| $passwordIsValid = false; |
| } |
| /** Check whether the boolean values show that the input data was validated successfully. |
| * If the data was validated successfully, add it as a new entry in the "wishers" database. |
| * After adding the new entry, close the connection and redirect the application to editWishList.php. |
| */ |
| <strong>if (!$userIsEmpty && $userNameIsUnique && !$passwordIsEmpty && !$password2IsEmpty && $passwordIsValid) { |
| |
| $query = "INSERT INTO wishers (name, password) VALUES (:user_bv, :pwd_bv)"; |
| $stid = oci_parse($con, $query); |
| $pwd = $_POST['password']; |
| oci_bind_by_name($stid, ':user_bv', $user); |
| oci_bind_by_name($stid, ':pwd_bv', $pwd); |
| oci_execute($stid); |
| oci_free_statement($stid); |
| oci_close($con); |
| header('Location: editWishList.php'); |
| exit; |
| }</strong> |
| }</pre> |
| </li> |
| </ol> |
| |
| |
| <h2><a id="errorMessagesInInputForm" name="errorMessagesInInputForm"></a>入力フォームでのエラー・メッセージの表示</h2> |
| <p>ここでは、入力したデータが無効であった場合のエラー・メッセージの表示を実装します。この実装は、検証と、<a href="#validatinDataBeforeAddingToDatabase">データの検証とデータベースへの追加</a>に説明されているブール型変数の値の変更に基づいています。 </p> |
| <ol> |
| <li>次のPHPコード・ブロックを、HTML入力フォーム内の、ウィッシャの名前入力の下に入力します。 |
| <pre class="examplecode">Welcome!<br><br><form action="createNewWisher.php" method="POST"><br> Your name: <input type="text" name="user"/><br/> |
| |
| <br> |
| <strong><?php |
| if ($userIsEmpty) { |
| echo ("Enter your name, please!"); |
| echo ("<br/>"); |
| } |
| if (!$userNameIsUnique) { |
| echo ("The person already exists. Please check the spelling and try again"); |
| echo ("<br/>"); |
| } |
| ?> </strong></pre> |
| </li> |
| <li>次のPHPコード・ブロックを、HTML入力フォーム内の、パスワード入力のコードの下に入力します。 |
| <pre class="examplecode">Password: <input type="password" name="password"/><br/> |
| <br> |
| <strong><?php |
| if ($passwordIsEmpty) { |
| echo ("Enter the password, please!"); |
| echo ("<br/>"); |
| } |
| ?></strong></pre> |
| </li> |
| <li>次のPHPコード・ブロックを、HTML入力フォーム内の、パスワード確認のコードの下に入力します。 |
| <pre class="examplecode">Please confirm your password: <input type="password" name="password2"/><br/> |
| |
| |
| <br> |
| <strong><?php |
| if ($password2IsEmpty) { |
| echo ("Confirm your password, please"); |
| echo ("<br/>"); |
| } |
| if (!$password2IsEmpty && !$passwordIsValid) { |
| echo ("The passwords do not match!"); |
| echo ("<br/>"); |
| } |
| ?></strong></pre> |
| </li> |
| </ol> |
| <h3> <a name="testCreateNewWisherFunctionality"></a>新規ウィッシャの作成機能のテスト</h3> |
| <ol> |
| <li>アプリケーションを実行します。indexページが開きます。<br> <img alt="2つのオプションがあるアプリケーションのメイン・ページindex.php: 個人のウィッシュリストの表示およびウィッシュリストの作成" class="margin-around" src="../../../images_www/articles/72/php/wish-list-lesson3/index-php-3.png"></li> |
| <li>indexページで、テキスト「Still don't have a wish list?」の横にあるリンクをクリックします。次のフォームが開きます。<br> <img alt="ウィッシャとして登録するための空のフォーム" class="margin-around" src="../../../images_www/articles/72/php/wish-list-lesson3/create-new-wisher-empty-form.png"></li> |
| <li>フィールドを空白のままにし、「Register」をクリックします。エラー・メッセージが表示されます。<br> <img alt="エラー・メッセージが表示されたウィッシャ登録フォーム: 名前が入力されていません" class="margin-around" src="../../../images_www/articles/72/php/wish-list-lesson3/create-new-wisher-name-empty.png"></li> |
| <li>登録済のウィッシャの名前を入力し(たとえば、「Your name」フィールドに「Tom」と入力)、その他のフィールドを正しく入力して、「Register」をクリックします。エラー・メッセージが表示されます。</li> |
| <li>「Password」フィールドと「Please confirm your password」フィールドに異なる値を入力し、「Register」をクリックします。エラー・メッセージが表示されます。</li> |
| <li>「Your name」フィールドに「Bob」と入力し、両方のパスワード・フィールドに同じパスワードを指定して「Register」をクリックします。表示されるページは空ですが、次のようにURLがeditWishList.phpで終わっているため、リダイレクションは正しく渡されています。<br> <img alt="開始メッセージが表示されたeditWishList.phpページ" class="margin-around" src="../../../images_www/articles/72/php/wish-list-lesson3/edit-wish-list-empty.png"></li> |
| <li>データがデータベースに格納されたことを確認するには、「サービス」ウィンドウのwislist1ノードの下にあるwishersに移動し、コンテキスト・メニューから「データを表示」を選択します。<br><img alt="NetBeans IDEインタフェースを使用してデータベース内のデータを表示: 新しいウィッシャ「Bob」が追加されました" class="margin-around b-all" src="../../../images_www/articles/72/php/wishlist/wishers.png"></li> |
| </ol> |
| <h2><a name="lessonResultSourceCode"></a>現在のレッスン完了後のアプリケーション・ソース・コード </h2> |
| <p>MySQLユーザー: このレッスンが完了した後のプロジェクトの状態を反映したソース・コードをダウンロードするには、<a href="https://netbeans.org/files/documents/4/1929/lesson3.zip" target="_blank">ここ</a>をクリックします。</p> |
| <p>Oracleデータベース・ユーザー: このレッスンが完了した後のプロジェクトの状態を反映したソース・コードをダウンロードするには、<a href="https://netbeans.org/projects/www/downloads/download/php%252Foracle-lesson3.zip" target="_blank">ここ</a>をクリックします。</p> |
| <h2><a name="nextSteps"></a>次の手順</h2> |
| <p><a href="wish-list-lesson2.html"><< 前のレッスン</a></p> |
| <p><a href="wish-list-lesson4.html">次のレッスン>></a> </p> |
| <p><a href="wish-list-tutorial-main-page.html">チュートリアルのメイン・ページに戻る</a> |
| </p><br> |
| <div class="feedback-box" ><a href="/about/contact_form.html?to=3&subject=Feedback:%20PHP%20Wish%20List%20CRUD%203:%20Creating%20New%20User">このチュートリアルに関するご意見をお寄せください</a></div> |
| <br style="clear:both;" > |
| <p><a href="../../../community/lists/top.html">users@php.netbeans.orgメーリング・リストに登録する</a>ことによって、NetBeans IDE PHP開発機能に関するご意見やご提案を送信したり、サポートを受けたり、最新の開発情報を入手したりできます。</p> |
| <p><a href="../../trails/php.html">PHPの学習に戻る</a><br> |
| </p> |
| </body> |
| </html> |