You can download the completed assignment here:
Alright, this will take a lot of instructions, so please try to follow them as closely as possible.
First, you cannot test email from your local computer without using a special tool. Emails require an SMTP server in order to work. Even with WAMP or XAMPP installed, you do not have an SMTP server. So you will want to go here
and download that tool. Once it is downloaded, install it. Once it is installed, run it. Do not change any of the options. Just run it and leave it open. This tool will intercept any emails that your PHP attempts to send and will open the email in your default email client (Outlook or whatever else you have set up as your default email application).
Implementing all of this required a significant amount of work and changes. Doing the emails for the sign up was one thing. However, the emails for orders and order processing were a lot more difficult because there were no options for order or order processing. So all of that functionality had to be implemented before I could even worry about the emails.
When I started doing this, I noticed that your database for these things was setup incorrectly. First, you had a product list table and an inventory table. Both of these tables had a product name, a UPC Code, etc. That is a violation of basic normal form and will cause major issues when attempting to implement a front-end to the database (what we are doing). Most of those fields are only required in the product list table. The inventory table references the product list table, so those fields are completely redundant within the inventory table.
In addition to that, you had the inventory table referring to the product table and the product table referring to the inventory table on the same key. This is a recursive relation and a major database error. This will throw database errors ever time you attempt to insert an item into the database.
So, I had to make major changes to the database, including changing those table, adding order-related tables, and modifying the login table for the registration process. So the database you have is no good any more. The new database is very different.
You will want to drop your database and then recreate it and run the SQL I have included in this zip file. It is in the file called newdb.sql
Once you have correctly installed the email test tool, have it running, and have recreated your database with the new database file, you will be ready to test.
Start out by creating a new customer account. After you submit your account creation form, the page states "Account Created". At this time, the email test tool will trigger your default email application to open. For now, just keep it open. It will display the email from the web site.
Now, go to the login page on your site and try to log in as the new user. You will notice that you receive the message that your login is incorrect. That is because the registration has yet to be confirmed.
No go to the email that was opened and follow the link in the email. This will take you to your index page and you will receive a small message that the verification was successful.
Now attempt to log in and it will work.
Now you are logged in as a customer. Click on the "Place Order". Right now, the database has one product. Enter your quantity and place the order.
A new email is triggered in your default email client. It thanks you for your order and gives you a link to view your order. Click on the link and you will see a simple table with order details.
Now, log out from the site.
Log back in with the username admin password admin
Click on the navigation link called Admin Orders
You will the ability to Approve or Reject any pending orders. Click on one of them. This will trigger yet another email in your default email client that informs you that your order has either been approved and processed, or rejected.
So that covers all of the requirements for this particular assignment:
Registration Page - Done
Email on Registration - Done
Confirmation URL in Email - Done
Order Email - Done
Order Processed Email - Done
That is all of the requirements for this assignment.
I did change your inventory page because I had to change the inventory table so drastically in order to make it actually function as part of an order system and be in proper relational database format.
What you did was fine, but I do have one note. You should be avoiding mysql API functions (e.g., mysql_connect, mysql_select_db, mysql_query, etc.)
These functions are deprecated and the next release of PHP will have them removed completely from the PHP language. You shoudl avoid using functions that are deprecated because in the real world, they will eventually cause you major headaches. Better to learn and use the recommended and supported functions. This would be the mysqli object. You can see throughout the site how I utlize mysqli. And, of course, you can read all about it on php.net
It is actually much easier to use once you get used to it.
Let me know if you have any questions. I'm here to help.
Please remember to rate my answer. Thank you so much!