This is a small report on what went on in the PHP-MYSQL-HTML session. The goal of the session was very simple. "To create a Login page in simple HTML which accepts the username and password from the user. When the user clicks on send, a PHP page is called which accesses the backend MYSQL database to verify the entered information and directs him to another page if the entered information was correct."
The first step was to install the Web Server. The Web Server is the one which sits on your machine serving all your web pages. We learnt how to install this Web Server in the local machine. We installed XAMPP for Linux in a Ubuntu machine.
You can download XAMPP from here.
To install XAMPP, you need to do the following.
1. Goto the terminal (Applications -> Accessories -> Terminal)
2. Type in sudo su
3. Now navigate to the path where you have downloaded the XAMPP file.
4. Type in tar xvfz xampp-linux-1.7.2.tar.gz -C /opt
Once XAMPP is installed you can start it using the following steps.
1. Goto the terminal
2. Type in /opt/lampp/lampp start
Now you need to put all your website related files in a folder, inside /opt/lampp/htdocs. This is an important point to be noted. Sometimes you would be thrown with an error saying "You donot have permissions to access this folder". In that cases you can simply do this.
1. Goto the terminal.
2. Type in sudo nautilus .
3. Now navigate to the directory and do the necessary changes.
Now that you are ready with the Web Server, you need to get you have 3 nice steps to get your first website project up and running.
1. Designing the front end in HTML.
2. Designing the backend using MYSQL.
3. Connecting the front end and the back end using PHP.
Designing the HTML:
Some points to be noted:
1. The form should contain the required php file in the "action" attribute.
2. The button should be of type "submit".
I've uploaded the source code here.
Designing the backend MySQL:
- The phpMyAdmin is used for this purpose.
- To access phpMyAdmin goto your browser and type in http://localhost/
- Now click on phpMyAdmin from the list of options which appear on the side pane.
- phpMyAdmin gives you the GUI way of creating a database.
- Be sure that you draw your ER digrams and do your home work on Normalization before you create your database.
The PHP part:
- First we learnt what basic PHP was. Then we went on with creating variables and arrays.
- Important point to be noted is that arrays can have a "key" and a "value".
- We then learnt the connection between PHP and MYSQL.
- I've also uploaded these files here.
The final touch:
Once we did all this, I gave you a few information on the practical problems faced. We discussed on the md5 function. I also mentioned about cookies and sessions. I finally ended the session saying "The rest is left for you to explore :)"
You can learn basic PHP & HTML from "www.w3schools.com" which has an awesome collection of easy-to-read tutorials.
| Next > |
|---|




