Program cgs4854pgm3_4Fall2021
 
CGS 4854 - Website Construction and Management
Professor: Michael Robinson 
e-mail   : michael.robinson@cs.fiu.edu 

 ******************************************************************************
 *    !!!!*** USE THE TOOLS THAT WE HAVE LEARNED IN OUR CLASS ONLY ***!!!!    *
 ******************************************************************************

--------------------------------------------------------------------------------
Worth 10 Points

- Make sure your program is properly documented and aligned uniformally, looking
  professionally, I will take points off if it is not.

- Include the following documentation in EVERY web page:
  <!-- ***********************************************************************************
  Page Name  : current page name 
  Author     : Your Name 
  Your URL   : ocelot-aul.fiu/~__________
  Course     : CGS 4854 session, date, and time
  Program #  : Assignment #
  Purpose    : Describe what this page does 

  Due Date   : MM/DD/YYYY 

  Certification: 

  I hereby certify that this work is my own and none of it is the work of any other person. 

  ..........{ your full name }..........
  ************************************************************************************* -->


Purpose of this program:
------------------------
- Create this assignment using an editor only, NO TEMPLATES OR IDES ALLOWED.
- Extend your current website creating the new pages, described below, using html5,  
  php and mySql
- Using tools shown ***** IN CLASS ONLY *****.


New Programs to be created:
---------------------------
 1) Program3.php
 2) Controller3.php
 3) Save.php
 4) Find.php
 5) Modify.php 
 6) Delete.php  
 7) Clear.php
 8) Contact_me.php
 9) Contact_me_Controller.php
10) ContactMeSend.php

  
1) Program3.php
---------------
 a) DO NOT MODIFY YOUR PROGRAM2.PHP or CONTROLLER2.PHP
 b) Copy your program2.php into program3.php, in your includes folder.
 c) In program 3, FIX the errors, if any, that you had in program 2 
    to avoid losing points again in program 3.
 d) Copy your Controller2.php into Controller3.php, in your includes folder.
    In Controller3.php, FIX the errors, if any, that you had in Controller2.php 
    to avoid losing points again in Controller3.php.

 e) Add a NEW link called program 3 to your mainMenu.php, to display the following:

                         home    program 1    program 2    program 3

    See examples at:  
    
    http://users.cis.fiu.edu/~mrobi002/teaching/cgs4854/CSS/cssDropdownMenu.html
    
    Choose whatever colors, fonts and sizes you want, 

                             
    When you press the "program 3" link load the new program named program3.php, located in 
    your includes folder, displaying the following front end, in the following order:

    AGAIN, in the following order:
    
    Display your header page named YourLastName_header.html, found in your includes folder,
    - The First line can be any color, any font, any size  
    - Your Full name can be any color, any font, any size  
    - The horizontal line MUST BE green 
    - Any background color is allowed, if you want to use one,    
 
    displaying the following Front End (centered):
 
                              ====This is a Teaching Website====
                                         Joe Smith
            _______________________________________________________________________________

                         Home    Program 1    Program 2    Program 3
                                         
                       Telephone  _______________________
                           Email  _______________________                
                       Last Name  _______________________ 
                      First Name  _______________________ 
                         Address  _______________________
                            City  _____________
                           State  _____________                
                         Country  _____________
                             Zip  _____________ 
                                    
                        Comments  ----------------
                                  |              | 
                                  |              |
                                  ---------------- 

                       Dropdowns  ___________________^
                                                                       
                          Coffee  o  Light  o  Cuban  o  Sweet     o  Decaf
                           Major  [] IT     [] CS     [] Robotics  [] Cyber
                                                          
                                           $message
                                                                                       
                            Save  Find  Modify  Delete  Clear  Contact_Me
                                                             
                             Home    Program 1    Program 2    Program 3

                                        your full name



 *** NOTE that the submit buttons row has changed from program 2, to the following
 
                            Save  Find  Modify  Delete  Clear  Contact_Me
         
 *** NOTE that here, after one empty row, this section is different that the same area in program 2
 
                                        your full name



    - MAKE SURE THAT YOUR FRONT END IS TOTALLY ALIGNED AS SHOWN ABOVE.
    - MAKE SURE TO HAVE THE SHOWN LINE SPACES ABOVE 
    - MAKE SURE THAT YOUR radio buttons are aligned with your checkboxes
    - On the title section display your last name, first name, Program 3
    - At the following submit buttons:

                         Save  Find  Modify  Delete  Clear  Contact_Me

    - When you press any of the following five(5) buttons 

                         Save  Find  Modify  Delete  Clear

      call a new page named Controller3.php, implementing each button


    - When you press button number 6 ( Contact_Me ) 
      call a new page named Contact_me_Controller.php


    NOTE *******************************************************************************

    In this assignment we will be creating a mySql database with one primary key (index)
    **** MAKE SURE YOUR first field (on your program3 front end) 
         is your mySql Primary Key field, regarless of what you call it, examples:
         
         Customer Number, Order Number, Panther ID, Email, Telephone, etc 

    ************************************************************************************


2) Controller3.php
------------------
   Create the following programs, inside the includes folder, which will be called by your
   Controller3.php:
   1) Save.php
   2) Find.php
   3) Modify.php
   4) Delete.php  
   5) Clear.php
   6) Contact_me.php
   7) Contact_me_Controller.php


The above programs will implement the following functions as follow:
  
  
3) Save.php
-----------
To save a record in your mysql table, enter the primary key on program3.php 
and all the necessary information for that new record, and then press 
the SAVE button. Using controller3.php, pass all the data entered on program3.php 
front-end, using POST, to save.php, using your controller3.php program.
  
If the record is not FOUND in the customer table, save.php will add the new record into 
   the customer table, containing all the data entered in program3.php, displaying
   on the $message "Record yourPrimaryKey Added" using blue color.
   LEAVING all the data on the front-end 
else if the record already exist in the table, DO NOT ACCEPT THE DATA, and on
   on the $message display  
   "RECORD yourPrimaryKey ALREADY EXISTS" using RED color, 
   LEAVING all the data on the screen. 
  
  
4) Find.php 
-----------
To find a record in your customer mysql table, enter the primary key on program3.php and 
press the FIND button, program3.php will pass the primary key value, using POST, to  your controller3.php program, which then will call your find.php

If the record is found in the customers table, display all the corresponding fields
   found in your database, on the front-end of your program3.php, and on the $message, 
   using blue color, display "RECORD yourPrimaryKey FOUND". 
   LEAVING all the data on the screen
else on your $message
   using red color, display "RECORD yourPrimaryKey NOT FOUND".  
   LEAVING all the current data on the front-end of program3. 

   
5) Modify.php
-------------
Before you can modify a record, you need to find it first.
If the record exits in the table, and you want to modify any field(s), 
   DO NOT MODIFY THE PRIMARY FIELD just re-enter the field(s) you need to modify
   and press the MODIFY button, then using the Controller3.php, call modify.php 
   to update your customer table with all the data in program3.php's front-end.
   Pass data using POST. 
  
   If the process in modify.php is correctly done, using blue color, display
   "RECORD $PRIMARY_KEY MODIFIED" on the $message 
   LEAVING all  corresponding field(s) on the program3.php front-end.
else If the record can NOT be modified in the table, at $message 
   using red color, display "RECORD $PRIMARY_KEY CAN NOT BE MODIFIED, FIND IT FIRST". 
  
  
6) Delete.php
-------------
Before you can delete a record, you need to find it.
When the DELETE button is pressed on the program3.php front-end, controller3.php,
will call delete.php. 

If the record is found in your customer table, delete it from your customer table
   and on the $message
   using red color, display "RECORD $PRIMARY_KEY DELETED". 
   LEAVE ON THE front-end of program3.php all the DELETED data of the corresponding
   record so that the user can re-save the record in case it was deleted by mistake. 
else If the record is NOT found in the table (in case other user deleted this record 
   while you where trying to delete it), on the $message
   using red color, display "RECORD $PRIMARY_KEY CAN NOT BE DELETED, IT DOES NOT EXISTS". 
      
DO NOT ERASE THE DATA ON PROGRAM 3 FRONT-END


7) Clear.php
------------
When the clear button is pressed on the program3.php front-end, 
controller3.php will call clear.php which will set all memory values to "" 
and then controller3.php will call program3.php front-end, which will display
all current memory values, 


8) Contact_me.php
-----------------
When you press the Contact_me button, call the Contact_me.php program, which will look like this:

a - Display your header page named YourLastName_header.html, found in your includes folder.
    then display one empty row.
    
b - Display the heading "CONTACT ME" in bold and red color
    then display one empty row.
    
c - Display your mainMenu.php
    then display one empty row.

d - After this display all the following labels and input fields (aligned) as shown below.

e - The submit button will call your new Contact_me_Controller.php program 

f - The clear submit will clear all your php global variables for your contact_me 
    database/table, before refreshing your Contact_me front end.

                           ====This is a Teaching Website====
                                         Your Name
            _____________________________________________________________________ 

                                         CONTACT ME
                                         
                         Home    Program 1    Program 2    Program 3
                                          
                        Your Email  ___________________       
                        Last Name   ___________________
                        First Name  ___________________   
                                                  
                        Coffee      o  Light  o  Dark   o  Sweet    
                        Major       [] IT     [] CS     [] Physics 

                        Dropdowns   ___________________^
                
                        Comments    -------------------   
                                    |                 |
                                    |                 |
                                    -------------------
                                                                             
                                         Submit   Clear  
                                                                   
                         Home    Program 1    Program 2    Program 3
                                       

9) Contact_me_Controller.php
----------------------------
Fill in all the information requested on the Contact_me.php Front End and then press the SUBMIT 

This program will call it's own Contact_me_Controller.php, located in the includes folder, which will send all the data inputed in the Contact_me front end, 
***** to my email = michael.robinson@cs.fiu.edu *****
the data send MUST BE ALIGNED in two columns: the field label and the corresponding data, example

I recommend that you first sent this email to your email, until it displays your field names and the corresponding inputed data, as shown below, and then change your email address with MY email address
I MUST  be able to receive the email in my account to be able to GRADE this section.
                            
                            Your Email  abc@abc.com
                            Last Name   Smith 
                            First Name  Joe 

                            Coffee      Light  or  Dark  or  Sweet 
                            Major       IT  CS  Robotics 

                            Dropdowns   value chosen
                                                  
                            Comments    This is the comments data 




After you Submit your "Contact_me" data, display the following calling a new program named ContactMeSend.php :

                           ====This is a Teaching Website====
                                       Joe Smith
            _____________________________________________________________________ 
                                         CONTACT ME
                                         
                         Home    Program 1    Program 2    Program 3


                          Your message has been submitted to name@fiu.edu
                          
                                            thank you




New Programs to be created:
 1) Program3.php
 2) Controller3.php:
 3) Save.php
 4) Find.php
 5) Modify.php
 6) Delete.php  
 7) Clear.php
 8) Contact_me.php
 9) Contact_me_Controller.php
10) ContactMeSend.php


Special Instructions (Additional code samples):
http://users.cis.fiu.edu/~mrobi002/databases/cgs4854/ 
http://users.cis.fiu.edu/~mrobi002/includes/OcelotCreatingWebsite    
http://users.cis.fiu.edu/~mrobi002/includes/Web.php
https://users.cs.fiu.edu/~mrobi002/contactsus/contactUs.php


- In program 3, FIX the errors, if any, that you had in program2.php to avoid losing points again.
- In controller 3, FIX the errors, if any, that you had in controller3.php program, to avoid losing points again.



Submission of program 3:
------------------------
1 - Zip your public_html folder and rename it as follows:
    your last name, first initial of your first name, pgm3, zip
    and upload it to CANVAS, when this program is due, or before.

    
If you have any questions, please 
1 - email me at michael.robinson@cs.fiu.edu
2 - Contact our FREE Online Tutoring. 
    https://users.cs.fiu.edu/~mrobi002/tutoring/includes/tutoringOnline2021Fall.php

*** PLEASE REMEMBER, WE ARE HERE TO HELP YOU ***