1. Download and install PHP, Web Server, and MySql from one of the following sites. You can look up the lecture notes on the class webpage for tutorials of HTML, PHP and more to create webpages as needed.
PHP is compatible with various web servers like Apache and the Microsoft’s IIS as well. All the PHP scripts are executed on the server (Apache, IIS etc) and it supports various databases like MySQL, Oracle, Solid, Generic ODBC etc; however, it is mostly used with MySQL. A PHP file has an extension of .phtml, .php or .php3 and it may contain various HTML tags, texts and scripts. Although a .php file contains scripts but when it is returned to the browser, it is returned as a plain HTML file. You can view a PHP file in Notepad as a source as well (right click on php file to select Edit with NotePad ).
Note: Some MySql Commands in an old version are deprecated in the latest versions of WAMPServer, they will raise errors. mysq i are the new format for commands.
Note that there may be version mismatch problems. Not all versions of PHP's will run with Apache2.4.
For more info for this problem: http://forum.wampserver.com/read.php?2,119754,119754
Look at phpinfo( ) for get your server information
Example Codes in index.html, search_musicapp.php, search_musicapp1.php on the Class Webpage that implement the following Web Service Music Search.
Example 1 of HTML and PHP Scripts for Search Music by Name and Type
In the following 3 files (posted on the class web page) : To see source codes of php file, right click on the file, select Edit with Notepad or view as Source. Or you can open the folder as Web in VS. index.html search_musicapp.php search_musicapp1.php
1. Root Page in (index.html) shows menus in first page
2. In the menu “MUSIC” will display the next page: Search Page (in search_musicapp.php) that takes Name of product to search and Category Type of product as input and Search button to submit.
Search
Enter Name :
Select category Type: MUSIC APP
Search Reset
3. Search button (in search_musicapp1.php ) when clicked will
4) Display the result on the next page. The following Sample PHP Codes that implements a similar task with Search an employee with Name on the Company Website from Company database in MySql is given below:
Build Search function in Company Website in root page to search an employee who is working for the company as follow:
1. Company Webpage in root page “idex.html” has Search in menu. (You can list more menu choice if you want). When Search link in the menu is clicked, the next page (SerachPage.php) is displayed.
2. In the next Search Page (in SerachPage.php) has Text input box to take Last Name of Employee and two Input Buttons “Search” and “Reset”
3. On Submit the button Search, the server script (in Search.php) will be executed to display the serach result in the next page. Serach.php will connect to your database, search Employee table to find an employee with the Last Name. Then on next page, it will display the employee information as output: First, Last Name, Sex, Dno of the employee in Table form.
Sample codes for this Lab:
1. Create Index.html that shows all the home page menu including SEARCH menu with a href = “SearchPage.php”