Tutorial: Database - PHP - Add Security Users With Access Database
 

Dr. Thomas E. Hicks
Computer Science Department
Trinity University

 


Tutorials

 In order to use ODBC to enable web pages to update and query a database, the host computer must be running web server software. One of the Tutorials below might help you install web server software on your computer.

 IIS 5  Install on Windows XP Pro

IIS 5 Installation on Windows 2000 Pro/Server

Installing PWS on Windows 98

Install Apache With IIS

It might even help to read a tutorial that describes the need for Database Web Applications.

Database Need For Web Applications

You may use the basic ideas of this tutorial for either the ODBC connection or the MapPath connection..

Database - PHP - ODBC Connections

Database - PHP - MapPath Connections
 


Access Database - Security.dbc

For purposes of discussion, let us suppose that an Access Database, called Security.mdb, resides at the root of drive C. (See Below!) When a database is installed on the web server, the necessary ODBC drivers are also installed. If the web server does not have the database installed, then the ODBC drivers will have to be downloaded and installed; this process differs from database to database and is beyond the scope of this paper. Microsoft Access and the appropriate ODBC drivers have been installed on the server illustrated below.

The Security Database is opened and the Tables tab is selected; in order to keep our example simplistic, the Security Database has only a single table, called Users. The contents of our very simple Users table can be seen below.

Each record in the Users table contains fields Name, No, Password, and IDNo; these will be needed later.

The datatypes of each field may be seen below.

The Security Database above was is ultra trivial application which had only one database table. Relational databases often have many tables; this is true of Access databases as well. This database may be downloaded.

Security.zip


Relative Path To The Security.dbc

We are going to place all of the PHP files in folder C:\Inetpub\wwwroot\PHP.  We could place the database files anywhere on the drive. For security reasons, it is not a good idea to place them in the wwwroot directory.

For purposes of this tutorial, we shall assume that the Security database files are located in C:\Security. For purposes of this tutorial, we shall assume that the Security database is located in C:\.


Two Page Solution


There are many ways to solve a computer science problem and this task is no different. Although we could accomplish this task in a single page, I am going to opt for a two page solution which I think is easier and straight forward.

The first page shall be called AddSecurityUser.php. It shall be the responsibility of this page to prompt the user for a SoughtName, SoughtNo, and SoughtPassword and then transfer processing control to the second page.

The second page shall be called AddSecurityUserConfirmation.php. It shall be the responsibility of this page to add the user to the database table if the information is complete.  Control shall pass to a generic Error.php page in the event that the NewName is blank.  Control shall pass to a generic Error.php page in the event that the NewNo is blank.  Control shall pass to a generic Error.php page in the event that the NewPassword is blank.  Control shall pass to a generic Error.php page in the event that the NewPassword is not numeric.

The autonumber field, IDNo shall be automatically completed by the database.


The AddSecurityUser.php Code

 
<?PHP 
#========================================================================
#========================================================================
#====                   AddSecurityUser.php                          ====
#========================================================================
#====                                                                ====
#==== Purpose    : Prompt the user for the User Name, No, and        ====
#====              Password. Transfer info to page                   ====
#====              AddSecurityUserConfirmation.php for processing.   ====
#====                                                                ====
#==== Written By : Dr. Thomas E. Hicks               Date: 6/1/2003  ====
#========================================================================
#========================================================================

The documentation block provides a brief statement of purpose. Blocks of PHP code begin with <?PHP and end with ?>.


#--------------------------------------------------------------------------
#                         Include The Database Utilities
#--------------------------------------------------------------------------
   Include('../adodb/adodb.inc.php'); 

Include file adodb.inc.php which contains many of the database access extensions to PHP.


#--------------------------------------------------------------------------
#     This block of code starts a new session and clears any session 
#     variables. It shall make sure that the input boxes on this form
#     are initially blank; session variables shall store a copy of the
#     user responses in all input boxes so that they may be reloaded on
#     the page in the event that the user must return back to this page
#     because of invalid input. The PreviousPage variable shall 
#     enable the corresponding confirmation page to assure that it is 
#     only called from this page.    
#--------------------------------------------------------------------------
   If (!IsSet($NewName))
   {
      Session_Start();
      Session_UnSet();
      $NewName       = "";
      $NewNo         = "";
      $NewPassword   = "";
      $PreviousPage  = "Add1";
      $DeleteName    = "";
      Session_Register("NewDeleteName"); 
      Session_Register("PreviousPage"); 
   }

  $_SESSION["PreviousPage"] = "Add1";
?>

The first time this page is loaded, a new session is created. Variables NewName, NewNo, and NewPassword are initialized to blank and added to the collection of session variables. In the event that the user enters information incorrectly and must come back to correct this page, these variables will eliminate the need for the user to re-enter all of the form info.


<HTML>
<HEAD><TITLE>Dr. Thomas E. Hicks - AddSecurityUser.php </TITLE></HEAD>

The HTML places Dr. Thomas E. Hicks - AddSecurityUser.php in the browser title bar.


<BODY 	TEXT      = "#000000" 
	BGCOLOR   = "#000000" 
	VLINK      ="#000000" 
	ALINK      ="#000000" 
	BACKGROUND ="Paper.jpg">

This HTML code above defines the page background, the default text color, the default background color, and the default link colors.


<CENTER><FONT FACE ="Arial" SIZE="4">AddSecurityUser.php<BR>
Written By<BR>Dr. Thomas E. Hicks</FONT></CENTER>
<HR>

The HTML code above creates the following commercial at the top of the page.

AddSecurityUser.php
Written By
Dr. Thomas E. Hicks


<FORM   METHOD = "POST" 
        ACTION = "AddSecurityUserConfirmation.php">

This is a standard HTML form which shall provide the user an opportunity to enter information and submit/transfer that information to page AddSecurityUserConfirmation.php.


<TABLE 	BORDER      = "5" 
        CELLPADDING = "4" 
        CELLSPACING = "4" 
        STYLE       = "border-collapse: collapse" 
        BORDERCOLOR = "#800000" 
        BGCOLOR     = "#FFFFFF"
        ALIGN       = "Center">

A table shall be used to organize the prompts, buttons, and input boxes.


<TR><TD ALIGN = "Right"><FONT FACE ="Arial" SIZE="3" COLOR = "#0000FF"><B>
Enter Name         
<INPUT  TYPE    = "Text" 
        VALUE   = "<?PHP Print $NewName ?>" 
        NAME    = "NewName" 
        SIZE    = 20
        MAXSIZE = 20></B></FONT>
</TD></TR>

In the first row of the table shall be a prompt ==> Enter Name ==> and a 20 character text box in which to enter the information. Note that the name of the textbox is NewName; the post method will transfer this information to the confirmation page. The NewName input box will be blank the first time the page is loaded; in the event that the user enters data incorrectly and must come back to this page, the code

"<?PHP Print $NewName ?>"

code will re-fill the text box so that the user does not need to re-enter the Name field.


<TR><TD ALIGN = "Right"><FONT FACE ="Arial" SIZE="3" COLOR = "#0000FF"><B>
Enter No         
<INPUT  TYPE    = "Text" 
        VALUE   = "<?PHP Print $NewNo ?>" 
        NAME    = "NewNo" 
        SIZE    = 10
        MAXSIZE = 10></B></FONT>
</TD></TR>

In the first row of the table shall be a prompt ==> Enter No ==> and a 10 character text box in which to enter the information. Note that the name of the textbox is NewNo; the post method will transfer this information to the confirmation page. The NewNo input box will be blank the first time the page is loaded; in the event that the user enters data incorrectly and must come back to this page, the code

"<?PHP Print $NewNo ?>"

code will re-fill the text box so that the user does not need to re-enter the No field.


<TR><TD ALIGN = "Right"><FONT FACE ="Arial" SIZE="3" COLOR = "#0000FF"><B>
Enter Password         
<INPUT  TYPE    = "Text" 
        VALUE   =  "<?PHP Print $NewPassword ?>" 
        NAME    = "NewPassword" 
        SIZE    = 15
        MAXSIZE = 15></B></FONT>
</TD></TR>

In the first row of the table shall be a prompt ==> Enter Password ==> and a 15 character text box in which to enter the information. Note that the name of the textbox is NewPassword; the post method will transfer this information to the confirmation page. The NewNo input box will be blank the first time the page is loaded; in the event that the user enters data incorrectly and must come back to this page, the code

"<?PHP Print $NewPassword ?>"

code will re-fill the text box so that the user does not need to re-enter the Password field.


<TR><TD><CENTER>
<INPUT  TYPE    = "SUBMIT" 
        VALUE   = "Add User To Database!" 
        STYLE   = "BACKGROUND=BLUE; COLOR=#FFFFFF ;CURSOR=hand;  
                   FONT-FAMILY ='SYSTEM';FONT-SIZE=10pt">
</CENTER></TD></TR>
</TABLE></FORM>
</BODY></HTML>

The second row of the table shall contain a blue submit button whose caption is Display All Users With This Name Now! The remainder of the HTML  code above simply ends the table, the form, the body, and the document.


Complete Code For AddSecurityUser.php

The complete code may be found below. A working model may be found at

AddSecurityUsers.php

<?PHP 
#========================================================================
#========================================================================
#====                   AddSecurityUser.php                          ====
#========================================================================
#====                                                                ====
#==== Purpose    : Prompt the user for the User Name, No, and        ====
#====              Password. Transfer info to page                   ====
#====              AddSecurityUserConfirmation.php for processing.   ====
#====                                                                ====
#==== Written By : Dr. Thomas E. Hicks               Date: 6/1/2003  ====
#========================================================================
#========================================================================


#--------------------------------------------------------------------------
#                         Include The Database Utilities
#--------------------------------------------------------------------------
   Include('../adodb/adodb.inc.php'); 
#--------------------------------------------------------------------------
#     This block of code starts a new session and clears any session 
#     variables. It shall make sure that the input boxes on this form
#     are initially blank; session variables shall store a copy of the
#     user responses in all input boxes so that they may be reloaded on
#     the page in the event that the user must return back to this page
#     because of invalid input. The PreviousPage variable shall 
#     enable the corresponding confirmation page to assure that it is 
#     only called from this page.    
#--------------------------------------------------------------------------
   If (!IsSet($NewName))
   {
      Session_Start();
      Session_UnSet();
      $NewName       = "";
      $NewNo         = "";
      $NewPassword   = "";
      $PreviousPage  = "Add1";
      $DeleteName    = "";
      Session_Register("NewDeleteName"); 
      Session_Register("PreviousPage"); 
   }

  $_SESSION["PreviousPage"] = "Add1";
?>

<HTML>
<HEAD><TITLE>Dr. Thomas E. Hicks - AddSecurityUser.php</TITLE></HEAD>

<BODY 	TEXT       = "#000000" 
        BGCOLOR    = "#000000" 
        VLINK      = "#000000" 
        ALINK      = "#000000" 
        BACKGROUND = "Paper.jpg">

<CENTER><FONT FACE ="Arial" SIZE="4">AddSecurityUser.php<BR>
Written By<BR>Dr. Thomas E. Hicks</FONT></CENTER><HR>

<FORM   METHOD = "POST" 
        ACTION = "AddSecurityUserConfirmation.php">

<TABLE 	BORDER      = "5" 
        CELLPADDING = "4" 
        CELLSPACING = "4" 
        STYLE       = "border-collapse: collapse" 
        BORDERCOLOR = "#800000" 
        BGCOLOR     = "#FFFFFF"
        ALIGN       = "Center">

<TR><TD ALIGN = "Right"><FONT FACE ="Arial" SIZE="3" COLOR = "#0000FF"><B>
Enter Name         
<INPUT  TYPE    = "Text" 
        VALUE   = "<?PHP Print $NewName ?>" 
        NAME    = "NewName" 
        SIZE    = 20
        MAXSIZE = 20></B></FONT>
</TD></TR>

<TR><TD ALIGN = "Right"><FONT FACE ="Arial" SIZE="3" COLOR = "#0000FF"><B>
Enter No         
<INPUT  TYPE    = "Text" 
        VALUE   = "<?PHP Print $NewNo ?>" 
        NAME    = "NewNo" 
        SIZE    = 10
        MAXSIZE = 10></B></FONT>
</TD></TR>

<TR><TD ALIGN = "Right"><FONT FACE ="Arial" SIZE="3" COLOR = "#0000FF"><B>
Enter Password         
<INPUT  TYPE    = "Text" 
        VALUE   =  "<?PHP Print $NewPassword ?>" 
        NAME    = "NewPassword" 
        SIZE    = 15
        MAXSIZE = 15></B></FONT>
</TD></TR>

<TR><TD><CENTER>
<INPUT  TYPE    = "SUBMIT" 
        VALUE   = "Add User To Database!" 
        STYLE   = "BACKGROUND=BLUE; COLOR=#FFFFFF ;CURSOR=hand;  
                   FONT-FAMILY ='SYSTEM';FONT-SIZE=10pt">
</CENTER></TD></TR>
</TABLE></FORM>
</BODY></HTML>

You can see the results below:


The AddSecurityUserConfirmation.php Code

 
<?PHP 
#========================================================================
#========================================================================
#====           AddSecurityUserConfirmation.php                      ====
#========================================================================
#====                                                                ====
#==== Purpose    : Transfer to page Error.php and report error if    ====
#====              user does not enter the Sought Name. Transfer     ====
#====              to page Error.php and report error if the         ====
#====              search comes up empty. Display all users that     ====
#====              match the search query.                           ====
#====                                                                ====
#==== Written By : Dr. Thomas E. Hicks               Date: 6/1/2003  ====
#========================================================================
#========================================================================

The documentation block provides a brief statement of purpose. Blocks of PHP code begin with <?PHP and end with ?>.

 


#--------------------------------------------------------------------------
#                         Include The Database Utilities
#--------------------------------------------------------------------------
   Include('../adodb/adodb.inc.php'); 

#--------------------------------------------------------------------------
#                              Continue The Session
#--------------------------------------------------------------------------

Include file adodb.inc.php which contains many of the database access extensions to PHP. We are continuing the session established by the previous page.


#--------------------------------------------------------------------------
#           May Only Enter This Page From AddSecurityUser.php!
#-------------------------------------------------------------------------- 
   If ($_SESSION["PreviousPage"] != "Add1" )
   {
      Print "<Script Language = 'JavaScript'> " .
            "window.location = 'AddSecurityUser.php'</Script>";
      Print "  ";
      Exit;
   }

In the event that someone tries to go directly to the confirmation page, this will return them to the data entry page. Session variable, AddPageNo, is only initialized in page AddSecurityUser.php; if it is not initialized to Add1, the browser loads page AddSecurityUser.php.


#------------------------------------------------------------------------
#              Initializations - Fill Local/Sessio Variables
#------------------------------------------------------------------------
   $Counter     = 1;
   $NewPassword = Trim($_REQUEST["NewPassword"]);
   $NewName     = Trim($_REQUEST["NewName"]);
   $NewNo       = Trim($_REQUEST["NewNo"]);

Counter is initialized to 1. It shall be used to number the rows/records in the table.

NewName, NewNo, and NewPassword shall be passed to the confirmation page. You will not see them in the URL with the Post option.


#------------------------------------------------------------------------
#          Transfer To Page Error If User Does Not Enter A Name
#------------------------------------------------------------------------
   If (StrLen($NewName) == 0)
   {
      $ErrorMessage = "The Name May Not Be Blank!";
      Session_Register("ErrorMessage");
      Print "<script language = 'JavaScript'> " .
            "window.location = 'Error.php'</Script>";
      Print "  ";
      Exit;
   }

If the user fails to enter a NewName, then the length will be zero. A successful add requires the NewNameto be greater than zero.  In the event that the user leaves the NewName blank, a session variable, describing the error, is created and the generic Error.php is loaded to display the error.


#------------------------------------------------------------------------
#          Transfer To Page Error If User Does Not Enter A No
#------------------------------------------------------------------------
   If (StrLen($NewNo) == 0)
   {
      $ErrorMessage = "The No May Not Be Blank!";
      Session_Register("ErrorMessage");
      Print "<script language = 'JavaScript'> " .
            "window.location = 'Error.php'</Script>";
      Print "  ";
      Exit;
   } 

If the user fails to enter a NewNo, then the length will be zero. A successful add requires the NewNobe greater than zero.  In the event that the user leaves the NewNo blank, a session variable, describing the error, is created and the generic Error.php is loaded to display the error.


#------------------------------------------------------------------------
#          Transfer To Page Error If User Does Not Enter A Password
#------------------------------------------------------------------------
   If (StrLen($NewPassword) == 0)
   {
      $ErrorMessage = "The Password May Not Be Blank!";
      Session_Register("ErrorMessage");
      Print "<script language = 'JavaScript'> " .
            "window.location = 'Error.php'</Script>";
      Print "  ";
      Exit;
   } 

If the user fails to enter a NewPassword, then the length will be zero. A successful add requires the NewNameto be greater than zero.  In the event that the user leaves the NewPassword blank, a session variable, describing the error, is created and the generic Error.php is loaded to display the error.


#------------------------------------------------------------------------
#  Transfer To Page Error If User Does Not Enter A Numeric Value
#------------------------------------------------------------------------
   If (Is_Numeric($NewNo) == FALSE)
   {
      $ErrorMessage = "The Sought No Must Be Numeric!";
      Session_Register("ErrorMessage");
      Print "<script language = 'JavaScript'> " .
            "window.location = 'Error.php'</Script>";
      Print "  ";
      Exit;
  }

If the user must enter a numerical value for  NewNo.  In the event that the user a non-numerical value, a session variable, describing the error, is created and the generic Error.php is loaded to display the error.


#--------------------------------------------------------------------------
#              Access Database RealPath Connect To The Server
#--------------------------------------------------------------------------
#------------------------ Create A Connection Object ----------------------
   $Conn = New COM("ADODB.Connection"); 

#------------------------------ Absolute Path -----------------------------
   $ConnStr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" . 
             RealPath("C:\Security.mdb"); 

#------------------------------ Relative Path -----------------------------
   $ConnStr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" . 
             RealPath("../../../Security.mdb"); 

#--------------------------------- Connect --------------------------------
   $Conn->Open($ConnStr); 

The block of code above connects this page to the Security database. A connection object is created. Variable ConnString contains part of the connection arguments. The Conn.Open opens the Security database and associates it with the connection object.


#------------------------------------------------------------------------
#                    Add The Record To The Database
#------------------------------------------------------------------------
   $UserSQL = " INSERT INTO Users (Name, No, Password) "  .
              " VALUES ("                                 .
                          "'" . $NewName     .  "', "    .
                                $NewNo       .  ",  "    .
                          "'" . $NewPassword .  "'  "    .
                      ");";
 
   $UsersRecordSet = $Conn->Execute($UserSQL); 
?>

The SQL query is to add the new record to the Users database table. The standard SQL statement which we are trying to emulate with the variables is

INSERT INTO Users (Name, No, Password)
VALUES ('Mark', 88, 'Dr. Planet')


<HTML><HEAD>
<TITLE>Dr. Thomas E. Hicks - AddSecurityUserConfirmation.php </TITLE>
</HEAD>

The HTML places Dr. Thomas E. Hicks - AddSecurityUserConfirmation.php in the browser title bar.


<BODY 	TEXT      = "#000000" 
	BGCOLOR   = "#000000" 
	VLINK      ="#000000" 
	ALINK      ="#000000" 
	BACKGROUND ="Paper.jpg">

This HTML code above defines the page background, the default text color, the default background color, and the default link colors.


<CENTER>
<FONT FACE="Arial" SIZE="4">AddSecurityUserConfirmation.php<BR>
Written By<BR>
Dr. Thomas E. Hicks</font><P>
</CENTER>
<HR>

The HTML code above creates the following commercial at the top of the page.

AddSecurityUserConfirmation.php
Written By
Dr. Thomas E. Hicks


<P><FONT COLOR="#FF0000" FACE="Arial">
<?PHP
   Print $NewName ;
?> has been added to the database! <FONT>

Although it is not essential, we are going to display the name of the user added to the database.


<?PHP
#--------------------------------------------------------------------------
#                        Close & Terminate The Connections
#--------------------------------------------------------------------------
   $Conn->Close(); 
   $UsersRecordSet = null; 
   $Conn = null; 

Close the connection. Since the delete does not return a record set, you may not close it! Set both to null.


#--------------------------------------------------------------------------
# Terminate The Session
#--------------------------------------------------------------------------
   Session_UnSet();
   Session_Destroy();
?>

Close the connection. Since the delete does not return a record set, you may not close it! Set both to null.


</BODY></HTML>

The HTML  code above simply ends the body and the document.


Complete Code For AddSecurityUserConfirmation.php

The complete code may be found below. A working model may be found at

AddSecurityUsers.php

<?PHP 
#========================================================================
#========================================================================
#====           AddSecurityUserConfirmation.php                      ====
#========================================================================
#====                                                                ====
#==== Purpose    : Transfer to page Error.php and report error if    ====
#====              user does not enter the Sought Name. Transfer     ====
#====              to page Error.php and report error if the         ====
#====              search comes up empty. Display all users that     ====
#====              match the search query.                           ====
#====                                                                ====
#==== Written By : Dr. Thomas E. Hicks               Date: 6/1/2003  ====
#========================================================================
#========================================================================

#--------------------------------------------------------------------------
#                         Include The Database Utilities
#--------------------------------------------------------------------------
   Include('../adodb/adodb.inc.php'); 

#--------------------------------------------------------------------------
#                              Continue The Session
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
#           May Only Enter This Page From AddSecurityUser.php!
#-------------------------------------------------------------------------- 
   If ($_SESSION["PreviousPage"] != "Add1" )
   {
      Print "<Script Language = 'JavaScript'> " .
            "window.location = 'AddSecurityUser.php'</Script>";
      Print "  ";
      Exit;
   }

#------------------------------------------------------------------------
#              Initializations - Fill Local/Sessio Variables
#------------------------------------------------------------------------
   $Counter     = 1;
   $NewPassword = Trim($_REQUEST["NewPassword"]);
   $NewName     = Trim($_REQUEST["NewName"]);
   $NewNo       = Trim($_REQUEST["NewNo"]);

 
#------------------------------------------------------------------------
#          Transfer To Page Error If User Does Not Enter A Name
#------------------------------------------------------------------------
   If (StrLen($NewName) == 0)
   {
      $ErrorMessage = "The Name May Not Be Blank!";
      Session_Register("ErrorMessage");
      Print "<script language = 'JavaScript'> " .
            "window.location = 'Error.php'</Script>";
      Print "  ";
      Exit;
   }

#------------------------------------------------------------------------
#          Transfer To Page Error If User Does Not Enter A No
#------------------------------------------------------------------------
   If (StrLen($NewNo) == 0)
   {
      $ErrorMessage = "The No May Not Be Blank!";
      Session_Register("ErrorMessage");
      Print "<script language = 'JavaScript'> " .
            "window.location = 'Error.php'</Script>";
      Print "  ";
      Exit;
   } 

#------------------------------------------------------------------------
#          Transfer To Page Error If User Does Not Enter A Password
#------------------------------------------------------------------------
   If (StrLen($NewPassword) == 0)
   {
      $ErrorMessage = "The Password May Not Be Blank!";
      Session_Register("ErrorMessage");
      Print "<script language = 'JavaScript'> " .
            "window.location = 'Error.php'</Script>";
      Print "  ";
      Exit;
   } 

#------------------------------------------------------------------------
#  Transfer To Page Error If User Does Not Enter A Numeric Value
#------------------------------------------------------------------------
   If (Is_Numeric($NewNo) == FALSE)
   {
      $ErrorMessage = "The Sought No Must Be Numeric!";
      Session_Register("ErrorMessage");
      Print "<script language = 'JavaScript'> " .
            "window.location = 'Error.php'</Script>";
      Print "  ";
      Exit;
  }

#--------------------------------------------------------------------------
#              Access Database RealPath Connect To The Server
#--------------------------------------------------------------------------
#------------------------ Create A Connection Object ----------------------
   $Conn = New COM("ADODB.Connection"); 

#------------------------------ Absolute Path -----------------------------
   $ConnStr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" . 
             RealPath("C:\Security.mdb"); 

#------------------------------ Relative Path -----------------------------
   $ConnStr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" . 
             RealPath("../../../Security.mdb"); 

#--------------------------------- Connect --------------------------------
   $Conn->Open($ConnStr); 

#------------------------------------------------------------------------
#                    Add The Record To The Database
#------------------------------------------------------------------------
   $UserSQL = " INSERT INTO Users (Name, No, Password) "  .
              " VALUES ("                                 .
                          "'" . $NewName     .  "', "    .
                                $NewNo       .  ",  "    .
                          "'" . $NewPassword .  "'  "    .
                      ");";
 
   $UsersRecordSet = $Conn->Execute($UserSQL); 
?>


<HTML><HEAD>
<TITLE>Dr. Thomas E. Hicks - AddSecurityUserConfirmation.php </TITLE>
</HEAD>

<BODY   TEXT      = "#000000" 
        BGCOLOR   = "#000000" 
        VLINK      ="#000000" 
        ALINK      ="#000000" 
        BACKGROUND ="Paper.jpg">

<CENTER>
<FONT FACE="Arial" SIZE="4">AddSecurityUserConfirmation.php<BR>
Written By<BR>
Dr. Thomas E. Hicks</font><P>
</CENTER>
<HR>

<P><FONT COLOR="#FF0000" FACE="Arial">
<?PHP
   Print $NewName ;
?> has been added to the database! <FONT>


<?PHP
#--------------------------------------------------------------------------
#                        Close & Terminate The Connections
#--------------------------------------------------------------------------
   $Conn->Close(); 
   $UsersRecordSet = null; 
   $Conn = null; 
#--------------------------------------------------------------------------
#                              Terminate The Session
#--------------------------------------------------------------------------
   Session_UnSet();
   Session_Destroy();
?>
?>

</BODY></HTML>

You can see the results below:

 

Complete Code For Error.php

The complete code may be found below.

<?PHP
#====================================================================================
#====================================================================================
#====                          DisplayError.asp                                  ====
#====                                                                            ====
#==== Purpose : Display the global System variable ErrorMessage and provide the  ====
#====           User with a button which will allow them to return to the        ====
#====           original form two levels back in the history.                    ====
#====                                                                            ====
#==== Written By : Dr. Thomas E. Hicks                                           ====
#====================================================================================
#====================================================================================
?>
<HTML><BODY	BACKGROUND = "Paper.jpg">		
<HR>

<CENTER><p Align="Center"><b><Font Size=+0 Color="#660033">
<br>
<?PHP
	Print $ErrorMessage;
?>
</font></b>

<FORM METHOD="POST">
<INPUT TYPE    = "BUTTON" 
       VALUE   = "    Click This Button To Go Back To Correct The Problem!    " 
       STYLE = "BackGround=DarkGreen; Color=#FFFFFF ;Cursor=hand; ".
               "Font-Family ='system';Font-Size=10pt"
       OnClick = "history.go( -2 ); return true;">
</FORM>
<HR></CENTER></BODY></HTML>

Other Tutorials

Internet Database Tutorials

Database Need For Web Applications

PHP - ODBC Connections

PHP - MapPath Connections

PHP - Display Security Users With Access Database

 PHP - Display Video Customers With FoxPro Database

 PHP - Display Video Movies With FoxPro Database

PHP - Display Video Transact With FoxPro Database

PHP - Display Video Relationships With FoxPro Database

PHP - Display Video Who Checked Out What With FoxPro Database

PHP - Search Security For Users By Name With Access Database

PHP - Search Security For Users By No With Access Database
PHP - Delete Security For Users By Name With Access Database
PHP - Delete Security For Users By No With Access Database
PHP - Add Security Users With Access Database
 

IDC-HTX-ODBC Database Applications

Database Form Guidelines


May be accessed through URL: http://www.cs.trinity.edu/~thicks
May also be accessed through URL: http://carme.cs.trinity.edu
This Document May Not Be Printed or Reproduced Without Written Permission.
 2003 Copyright : Dr. Thomas E. Hicks
Permission granted : Professional Educators & College Students may print one copy of this page!

Dr. Thomas E. Hicks

Computer Science Department    
Trinity University

"Dr. Web"