cms report.docx

56
. LIST OF CONTENTS 1. INTRODUCTION 1.1 Purpose..................................................... ..................................12 1.2 Scope & Objectives.................................................. ..................12 1.3 Definitions, Acronyms and Abbreviations.................................13 1.4 Overview.................................................... ................................14 2. METHODOLOGY 2.1 Project Perspective................................................. ...................15 2.1.1 System Interfaces.................................................. ........15 2.1.2 User Interfaces.................................................. ............15 2.1.3 Hardware Interfaces.................................................. ....16 2.1.4 Software Interfaces.................................................. ......17 2.1.5 Communication Interfaces.............................................17

Upload: raghvendra

Post on 05-Sep-2015

28 views

Category:

Documents


0 download

TRANSCRIPT

. LIST OF CONTENTS

1. INTRODUCTION1.1 Purpose.......................................................................................121.2Scope & Objectives....................................................................121.3Definitions, Acronyms and Abbreviations.................................131.4Overview....................................................................................142. METHODOLOGY2.1Project Perspective....................................................................152.1.1 System Interfaces..........................................................152.1.2 User Interfaces..............................................................152.1.3 Hardware Interfaces......................................................162.1.4 Software Interfaces........................................................172.1.5 Communication Interfaces.............................................172.1.6 Memory Constraints.......................................................172.2User Characteristics....................................................................172.4Constraints.................................................................................202.5Assumptions and Dependencies..............................................202.6Apportioning of Requirements..................................................20

3. SPECIFIC REQUIREMENTS3.1External Interfaces......................................................................213.2Functions....................................................................................213.3Performance Requirements.......................................................213.4Logical Database Requirements................................................213.5Design Constraints......................................................................223.6Software System Attributes........................................................253.6.1 Maintainability.................................................................263.6.2 Portability........................................................................263.6.3 Availability.......................................................................263.6.4 Reliability.........................................................................273.6.5 Security...........................................................................273.7Organizing the Specific Requirements.............................,,,,,,...263.7.1 System Mode.................................................................263.7.2 User Class......................................................................263.7.3 Objects............................................................................263.7.4 Use Cases......................................................................273.7.5 Features..........................................................................27

4. INTRODUCTION OF PHP4.1Introduction to PHP for web development...................................29 4.2Benefits and importance of PHP.................................................29 4.3Basic requirements of PHP.........................................................30 4.4Types of PHP..............................................................................304.5Installation of tools.......................................................................31 4.6How to access the PHP files.......................................................35 4.7Comments in PHP.......................................................................36 4.8Data types...................................................................................36 4.9PHP Variables.............................................................................37

5. PHP WITH FUNCTIONS5.1User defined functions.................................................................38 5.2PHP Strings.................................................................................38 5.3Concatenate Operator.................................................................39 5.4Some built-in functions................................................................39 5.5PHP Include and Require Functions............................................39

6. PHP WITH WEB DESIGN6.1HTML Forms................................................................................41 6.2Database Connectivity.................................................................43 6.3Closing Connection......................................................................43 6.4Creating HTML form using MySQL..............................................44

7. OOPS CONCEPT IN PHP7.1Type Hinting.................................................................................47 7.2Object Cloning.............................................................................47

8. WORKING WITH FILES8.1Uploading a file............................................................................49

8.2 Providing restrictions on Upload..................................................50

8.3 Downloading a file........................................................................50

9. SATAE MANAGEMENT9.1Cookies........................................................................................52 9.2Session........................................................................................53

10. MYSQL DATABASE AND SQL10.1Creating Database Tables.........................................................56 10.2What is SQL...............................................................................58

11. PROJECT PROFILE11.1Tools used for working in PHP..................................................60 11.2My Project.................................................................................62

12. CONCLUSION 13. REFERANCES

LIST OF FIGURES

1.INTRODUCTION1.4Overview...............................................................................................14

2.METHODOLOGY2.1Project Perspective...............................................................................152.1.2User Interfaces...........................................................................162.2User Characteristics..............................................................................18

3.SPECIFIC REQUIREMENTS3.4Logical Database Requirements..........................................................213.4 (a) Login.......................................................................................223.4 (b) Sign Up...................................................................................223.5Design Constraints................................................................................223.5 (a) DFD 0 Level............................................................................233.5 (b) DFD 1 Level............................................................................243.5 (c) ER Diagram.............................................................................263.7Organizing the Specific Requirements..................................................263.7.4 Use cases..................................................................................27

4.INTRODUCTION TO PHP4.3Basic requirements of PHP...................................................................30 4.5Installation of tools................................................................................31 4.9PHP Variables.......................................................................................37

5.PHP WITH FUNCTIONS5.3Concatenate Operator............................................................................38 5.5PHP Include and Require Functions......................................................40

6.PHP WITH WEB DESIGN6.1HTML Forms..........................................................................................42 6.4Creating HTML form using MySQL........................................................45

7.OOPS CONCEPT IN PHP7.2Object Cloning........................................................................................48

8.WORKING WITH FILES8.1Uploading a file......................................................................................49 8.3Downloading a file..................................................................................51

11.PROJECT PROFILE11.1Tools used for working in PHP 11.1 (a) Wamp Server..........................................................................61 11.1 (b) PHP MyAdmin.........................................................................61 11.1 (c) PHP Designer.........................................................................62

ABSTRACT

The main objective of this project College Management System is to provide an easy way to circulate all the functionalities of a college, and manipulate data and information about administration, students and staff easily and also to manage the task related to the college students/ employees/ administration and to reduce time to searching of appropriate candidates in college view. College Management System synchronizes the working of all the departments. It looks on all aspects of a college, its students, faculties, Departments, marks and other co curricular activities.

The College Management System is basically build to provide a system to manage a college. Without automation the management of the college has become an unwieldy task. The end users day-to-day jobs of managing a college will be simplified by a considerable amount through the automated system. The system will be able to handle many services to take care of all the students as well as staff in a quick manner. The system should be user appropriate, easy to use, provide easy recovery of errors and have an overall end user high subjective satisfaction.

There are two end users for the CMS. The end users are the staff and the students and other one is the administrator. Both user types can access the website through Login ID. The general Management System will be restricted to management users. This system provides the detail structure of the college campus and its departments.

CHAPTER 1 INTRODUCTION This system provides the detail structure of the college campus and its departments. College Management System synchronizes the working of all the departments. It looks on all aspects of a college, its students, faculties, Departments, marks and other co curricular activities. The following subsections of the report provide an overview of the entire project.

Purpose The report will provide a detailed description of the requirements for the College Management System (CMS). This SRS will allow for a complete understanding of what is to be expected of the CMS to be constructed. The clear understanding of the CMS and its functionality will allow for the correct software to be developed for the end user and will be used for the development of the future stages of the project. This report will provide the foundation for the project. From this report, the CMS can be designed, constructed, and finally tested.

This report will be used by the software engineers constructing the CMS and the system end users.The software engineers will use the SRS to fully understand the expectations of this CMS to construct the appropriate software. The college end users will be able to use this report as a test to see if the software engineers will be constructing the system to their expectations. If it is not to their expectations the end users can specify how it is not to their liking and the software engineers will change the SRS to fit the end users needs.

Scope The main scope of this project College Management System is to provide an easy way to circulate all the functionalities of a college, and manipulate data and information about administration, students and staff easily and also to manage the task related to the college students/employees/administration and to reduce time to searching of appropriate candidates in college view.

The software product to be produced is a College Management System which will automate the major college operations. These three subsystems functionality will be described in detail in section 2-Overall Description. There are two end users for the CMS. The end users are the staff and the students and other one is the administrator. Both user types can access the website through Login ID. The General Management System will be restricted to management users. This system provides the detail structure of the college campus and its departments. College Management System synchronizes the working of all the departments. It looks on all aspects of a college, its students, faculties, Departments, marks and other co curricular activities. The College Management Systems objectives is to provide a system to manage a college. Without automation the management of the college has become an unwieldy task. The end users day-to-day jobs of managing a college will be simplified by a considerable amount through the automated system. The system will be able to handle many services to take care of all the students as well as staff in a quick manner. The system should be user appropriate, easy to use, provide easy recovery of errors and have an overall end user high subjective satisfaction.

Definitions, Acronyms, and Abbreviations

PHP PHP: Hypertext Preprocessor

WAMP Windows Apache MySQL PHP

CMS College Management System

DFD Data Flow Diagram

CFD Context Flow Diagram

SQL Structured Query Language

ER Entity Relationship

Subjective satisfaction The overall satisfaction of the system

End users The people who will be actually using the system

1.4 OverviewThe report is organized into two main sections. The first is The Overall Description and the second is the Specific Requirements. The Overall Description will describe the requirements of the CMS from a general high level perspective.

The Specific Requirements section will describe in detail the requirements of the system.

The implementation of College Management starts with entering and updating master records like students, employee details, e-library, college information.

Fig 1.4

CHAPTER 2 METHODOLOGY

2.1Project PerspectiveThe CMS is an independent standalone system. It is totally self contained.

2.1.1 System InterfacesStudents can connect both systems to retrieve information on their academic progress. System interface are the interfaces between the system and external environment. In any software product, almost half of the interface with human-computer interaction, which provide the best way for user to interact with computer. Describe the system capacity hard disk-256 MB , RAM-1 GB. This makes it possible to the application on different environments without any modification to the code. The software requires a mouse or keyboard, a graphical user environment .processor required (windows7, window 8) dual core and quad core.Students can connect both systems to retrieve information on their academic progress.

2.1.2 User InterfacesThe software provides good graphical interface for the user any administrator can operate on the system, performing the required task such as create, update, viewing the details of the student and staff.Allows user to view quick reports of the student like attendance and internal marks etc in between particular time. Stock verification and search facility based on different criteria.

The User Interface Screens are described in the table.

Table : College Management User Interface ScreensScreen NameDescription

LoginLog into the system

Sign-upFor the new users to get registered

FormTo provide the users to get registered for the college regarding admissions and other activities

Fig 2.1.2(a)

Fig 2.1.2(b)2.1.3 Hardware Interfaces Server SideThe web application will be hosted on one of the departments WAMP servers and connecting to one of the school MySQL server. The web server is listening on the web standard port, port 80. Client SideThe system is a web based application; clients are requiring using a modern web browser such as Mozilla Firebox 1.5, Internet Explorer 6 and Enable Cookies. The computer must have an Internet connection in order to be able to access the system. Operating System : Windows Hard disk : 40 GB RAM : 256 MB Processor : Pentium(R)Dual-core CPU2.1.4 Software Interfaces Server SideThe UOP already has the required software to host a Java web application. An Apache Web server will accept all requests from the client and forward SUMS specific requests to Tomcat 5.5 Servlet

Container with J2EE 5.0 and Strut 1.2.8 hosting SUMS. A development database will be hosted locally (using MySQL); the production database is hosted centrally (using Oracle). Client SideAn OS is capable of running a modern web browser which supports HTML version 3.2 or higher. WAMP server Adobe Dreamweaver PHP Designer WOW Slider CSS3 Menu2.1.5 Communication InterfacesThe system shall be a standalone product that does not require any communication interfaces.The HTTP protocol will be used to facilitate communications between the client and server.2.1.6 Memory ConstraintsThe memory constraints include RAM of 256 MB.

2.2 User CharacteristicsWe have 2 levels of users.User module : In the user module, user will check their attendance and internal marks and college events. Login Forms Reports WindowModule wise description :Login :Login module is used to check whether the user is an authorized person to use the system or not. For this the user should give the correct user name and password.The different types of users are -- Admin Student Employee Fig 2.2

Forms :This module consists of the following sub modules Student Registration Form - The Student Registration Form is designed for registering the new students details and course details. Student Fee Form - The Student Fee Form is used to enter the students fee details.

Student Marks Form - The Student Marks Form is designed for submitting the semester or exam marks of the students for a particular course or an individual student.

Student ID Form - The Student Id Form is used to create the identity number for each student for different courses.

Employee Detail Form - The Employee details form is designed for entering the staff details and other relevant details.

Employee ID Form - The Employee Id used to create the identity number for each student for different course.ReportsAll the above mentioned data are stored in the back end and can be retrieved as reports with filtering options. The Following are the reports that can be taken from this system Student Report Employee Report Course Detail Report Fee Detail Report Marks Detail ReportAdministration module : The following are the sub modules in the administration module. Register user Enter student details Enter staff details Student attendance update

2.3 Constraints Any update regarding the student from their branch is to be recorded to have update & correct values.2.4 Assumptions and DependenciesAll the data entered will be correct and up to date. This software package is developed using PHP as the front end which is platform independent. Its code can be run on Linux, Unix, Windows etc. Microsoft SQL server can be used as the back end which is supported by Windows Operating System.2.5 Apportioning of RequirementsThe audio and visual alerts will be deferred because of low importance at this time.

CHAPTER 3 SPECIFIC REQUIREMENTS

3.1 External InterfacesThe user should be simple and easy to understand and use. Also be an interactive interface.The system should prompt for the user and administrator to login to the application and for proper input criteria.3.2 FunctionsFunctional requirements define the fundamental actions that system must perform.Students and Employee entry : In this module we can store the details of the students and staff. Register student and employee : In this module we can get admission and other details of the student.3.3 Performance RequirementsThe capability of the computer depends on the performance of the software. The software can take any number of inputs provided the database size is larger enough. This would depend on the available memory space.Performance requirements define acceptable response times for system functionality. The load time for user interface screens shall take no longer than two seconds. The log in information shall be verified within five seconds. Queries shall return results within five seconds.

3.4 Logical Database Requirements The logical database requirements include the retention of the following data elements. This list is not a complete list and is designed as a starting point for development.

Login

Field Type Null Default

Student_Id Varchar (20) Yes Null

Name Varchar (20) Yes Null

Password Varchar (20) Yes Null

Fig 3.4 (a)

Sign_up Field Type Null Default

NameVarchar (20)YesNULL

GenderVarchar (20)YesNULL

Date_of_BirthVarchar (20)YesNULL

FacultyVarchar (20)YesNULL

CourseVarchar (20)YesNULL

Student_IdVarchar (20)YesNULL

Email_IdVarchar (20)YesNULL

PasswordVarchar (20)YesNULL

ContactVarchar (20)YesNULL

NationalityVarchar (20)YesNULL

Fig 3.4(b)

3.5 Design ConstraintsEach Student and Staff will be having a identity card which can be used to identify the branch and year of the student. Depends on the status of the student they can go to their respective class room and they can attend the classes and for the staff , they will have a different identity card to identify them. DFD - DATA FLOW DIAGRAM

0level DFD 1level DFD 2level DFD

A data flow diagram (DFD) is a graphical representation of the "flow" of data through information system modelling its process aspects. A DFD shows what kinds of information will be input to and output from the system, where the data will come from and go to, and where the data will be stored.

Representation of Components :

ProcessTransform of incoming data flow to outgoing flow.

Data FlowMovement of data in the system.

Data StoreData repositories for data that are not moving. It may be as simple as a buffer or a queue or as sophisticated as a relational database.

External EntitySources of destinations outside the specified system boundary.

Fig : Data Flow Diagram

CFD - CONTROL FLOW DIAGRAM

A control flow diagram (CFD) is a diagram to describe the control flow of a process or program. ER-DIAGRAM - ENTITY RELATIONSHIP DIAGRAMEntity Relationship modelis an abstract way to describe adatabase. It usually starts with a relational database, which stores data in tables. It is a graphical tool to represent an algorithm. It makes different symbols representing different instructors of algorithm. Ellipse:

This represents the START or STOP. Square:

This represents input or output.

3. Rectangle:This represents process.

4. Diamond:This represents a condition.

Fig : ER Diagram

3.6 Software System Attributes3.6.1 Maintainability : There will be no maintained requirement for the software. The database is provided by the end user and therefore is maintained by this user. The College Management System shall run in any Microsoft Windows environment.3.6.2 Portability : The system is developed for secured purpose, so it is cant be portable. 3.6.3 Availability : This system will available only until the system on which it is install, and is running. The College Management System is being developed in PHP. PHP is a platform independent and user friendly language. Its database may be MySQL.3.6.4 Reliability :It specifies the factors required to establish the required reliability of the software system at time of delivery.3.6.5 Security :The administrator and the users which are already registered will be able to log in to the College Management System. Only those users who are registered and their details are present in the database controlled by the administrator can login and visit the internal pages of the system. those who are not registered can not enter the system. The administrator will have access to the databases and other details of the students and the staff.Access to the various subsystems will be protected by a user log in screen that requires a user name and password.

3.7 Organizing The Specific Requirements3.7.1 System ModeSome systems behave quite differently depending on the mode of operation. When organizing by mode there are two possible outlines. The choice depends on whether interfaces and performance are dependent on mode.3.7.2 User ClassThe distinct category of users is generally referred to a user class. It consists of those users who will use the website. In College Management System, the users may be the administrator, students, staff and faculty members.

3.7.3 ObjectsObjects represent some entities, access methods from its parent class and has attributes that distinguish them from other objects in the system. They can represent anything with which properties and behaviour can be associated, where properties describe the current state of the object and behaviour shows the way an object acts and reacts thereby changing its state.3.7.4 Use CasesUse cases were introduced into object analysis by Jacobson as a means of communication with users. They are scripts that describe typical ways that a system is or well be used. A use case is general in the sense that it doesn't describe instances of how a system is used, but generalizes a number of instances into a general script.Use cases should achieve the following objectives : To define the functional and operational requirements of the system by defining a scenario of usage that is agreed upon by the end-user and the software engineering team. To provide a clear and unambiguous description of how the end-user and the system interact with one another. To provide a basis for validation testing

Fig : Use Case Diagram

3.7.5 Features User friendly Browser based Calendar of Events Single database management system and necessary security is provided against unauthorized access through authorized sign-in process Multi User environment and assigning privileges to the users It is completely user friendly College Management Software The complex task of report generation is an extremely easy work Using College Management Software Graphical Representation of admissions every year Time Table Generation Marks and attendance information Mailing system Promotion of Students to higher semesters Teaching dairy Lecture plan Fee management Full fledged Library Management System Provides complete features of Payroll Management System like Allowances, deductions, generation of pay slip and many more for staff Applying Leave online Online Examination module helps you to provide training to the students appearing for campus interviews Transportation management Exporting important reports to Microsoft Excel Total hostel management process Placements module (under development) User manual is provided

CHAPTER 4 INTRODUCTION OF PHPPHP is one of the popular scripting languages for web applications and has many advantages over the traditional web applications. This chapter provides one of the better understanding about PHP, its history and benefits. It also provides information about how to install and configure PHP in your system. It also provides fair information about PHP data types, variables, operators and decision making statements.

4.1Introduction to PHP for Web Development & Web ApplicationsPHP is the short form of ' PHP : Hypertext Preprocessor '. It is widely used open source scripting language for web applications. The first version of PHP was released in 1994 by Rasmus Lerdorf. Latest version of PHP is PHP 5.3 launched in 2010.PHP is considered to be a powerful tool for developing web applications. PHP is server - side scripting language that is embedded with HTML. PHP helps the user to handle databases, dynamic contents, session tracking etc. PHP also helps the user to build entire e - commerce, e - learning web portals easily. It is integrated with a number of databases such as PostgreSQL, Informix, MySQL, Oracle, Sybase and MS SQL and also supports protocols such as LDAP, IMAP, POP3, HTTP etc.One can easily develop attractive websites with the combination of client - side scripting languages ( like Java Script / JQuery ) and server - side scripting language ( PHP ). The syntax of PHP is almost similar to most popular languages such as C. C++, JAVA. PHP is a free tool which can be downloaded without any license. PHP supports different platforms such as LINUX, UNIX, WINDOWS, Mac OS etc. which makes the developers comfortable and create user - friendly applications.4.2Benefits and Importance of PHP in Web ApplicationsPHP is web developer's popular choice in today's web design and development. It is considered to be a general purpose web scripting language mainly used as a server - side web development platform. Its clarity in design, well organized modules and better upkeep of various technologies make it different from other popular languages available. PHP's credibility and popularity can be measured by the fact that social networking sites such as Facebook and organizations like Harvard University, are based on PHP. This has made possible through the fact that PHP websites can be easily maintained, and updated from time to time without redesigning the entire programming codes.Following are the few advantages of PHP :(i) Open Source - It is freely available and can be customized very easily.(ii) Platform Independent - It is platform independent. Its code can be run on LINUX, UNIX, WINDOWS etc.(iii) Free of cost - It is free of cost and easily available.

4.3Basic requirements when using PHP(i) Client - It sends requests. eg. Internet Explorer or Browser (ii) Server - It provides responses. eg. IIS, Apache, Glassfish, Tomcat(iii) Programming Environment - It is the language in which code is written i.e. PHP. WEB SERVER Web page request Load PHP fileU HTML responsePHP resultsFig. 4.34.4Types of PHP(i) WAMP - Windows Apache MySQL PHP(ii) XAMP - Extension Apache MySQL PHP(iii) LAMP - LINUX Apache MySQL PHP(iv) MAMP - Machintosh Apache MySQL PHP4.5Installation of tools for working in PHPXAMP Installation :For installing XAMP on your windows machine follow these steps :1.Download XAMP from internet.2.Double click on XAMP installer to open the Installer Language, is shown in figure below :

Fig. 4.5(a)3.Select English language from Please select a language check list.4.Click on OK button to open the XAMP 1.7.4 win32 setup dialog box, is shown in the following figure :

Fig. 4.5(b)

5.Click on OK button to go to the Welcome to the XAMP 1.7.4 Setup Wizard window, is shown in the figure below :

Fig. 4.5(c)6.Click on NEXT button to open the Choose Install Location window, is shown in the figure below :

Fig. 4.5(d)

7.Select the Destination Folder and click NEXT button to open the XAMP Options window, is shown in the figure below :

Fig. 4.5(e)8.Select the Install Apache as service and Install MySQL as service option check box on SERVICE SECTION.9.Click Install button to install the XAMP 1.7.4, is shown in the figure below :

Fig. 4.5(f)10.After installing the XAMP 1.7.4, a Copyright section will appear, is shown in the figure below :

Fig. 4.5(g)11.After Copyright screen display Completing the XAMP 1.7.4 Setup Wizard message window will appear, is shown in the figure below :

Fig. 4.5(h)12.Click FINISH button to close this wizard.

13.After Click Finish button of XAMP 1.7.4 Setup Wizard Service Installation Finished ! hint message box will display on your screen :

Fig. 4.5(i)14.Click OK button to successful install, confirmation message will appear on your screen.15.Click YES to installed the XAMP 1.7.4 win32 and run the Apache and MySQL service, is shown in the figure below :

Fig. 4.5(j)4.6How to access the PHP filesYou can use the browser to access the file you saved in the PHP folder. You can access the PHP files using the files from http : // localhost / test.php or http : // 127.0.0.1 / filename.php. The Web Server will be parsed by PHP and the output will be sent to your browser.

4.7 Comments in PHPExample : 4.8 Data TypesData types are types of data and the operations that can perform on those data. PHP supports 8 different data types as follows : Integers Floats Strings Booleans Arrays Objects Resources NullPHP supports two special kinds of data types Null and Resources. Resources are not an actual data type, but storing of reference to function and resources external to PHP.The very common example of using the resource data type is a database call.Null is a special kind of data type which may have only one value, which is itself a keyword. In other words, we can say that Null is not only a data type but also a keyword literal. A Null variable is a variable that has no value assigned to it. Whenever we create a variable without a value, it is automatically assigned a null value.

4.9 PHP VariablesPHP variable is used for storing a value, such as string " Hello World ! " or the integer value 4.Naming rules of PHP variables : A variable starts with the $ sign and preceded by the name of the variable. Name of variables must begin with a letter or the underscore character. Name of variables can only contain alpha - numeric characters and underscores ( A-z, 0 - 9 and _ ). Name of variables should not contain spaces. Name of variables are case - sensitive ( $y and $Y are two different variables ).

Types of Variables : Local Global Static Output : 8 5 ParameterExample of Local Variable :

CHAPTER 5 PHP WITH FUNCTIONS

5.1 User defined functionsUser defined functions are created by the user for performing some specific task in the script.Syntax :functionfunction_name ( ) { // some code }

5.2 PHP StringsPHP supports a 256 character set of strings. A string is a series of characters, where a character is the same as a byte.Example :$string_1 = " This is a string " ; $string_2 = " " ; // This is a string with zero character

5.3 Concatenate OperatorPHP supports only one string operator. You can join two string values together using the concatenation operator ( . ).Output :My name is ABCExample : Fig. 5.3

5.4 Some Built - in functions of PHP strlen ( ) - It returns the length of a string, in characters. strpos ( ) - It is used for finding the position of the first occurrence of a substring in a string. chr ( ) - It is used for returning a specific character. echo ( ) - It is used for outputting one or more strings. print ( ) - It is used for outputting a string. explode ( ) - It is used for splitting a string by string. implode ( ) - It is used for joining array elements with a string. lcfirst ( ) - It is used for making first character of a string lowercase. ucfirst ( ) - It is used for making first character of a string uppercase. ucwords ( ) - It is used for making the whole string uppercase. str_split ( ) - It is used to split all the characters of the string into indexes. str_shuffle ( ) - It is used to shuffle all the characters of the string. strstr ( ) - It is used for finding the first occurrence of a string. trim ( ) - It is used for stripping whitespace from the beginning & end of a string.

5.5 PHP Include and Require Functions5.5.1 include ( ) function :include ( ) function uses all the contents of one file into another file where it included.Example :Suppose you want to develop the code for a website where header and footer will be same for all web pages then you should create a file called as " header.php " and " footer.php " , and using include ( ) function you can use the same header and footer in all your web pages.

header.php

Output :This is my headerThis is my home pageThis is my footer

footer.php home.php

5.5.2 require ( ) function :The functionality of require function is same as that of include. The major difference between require ( ) and include ( ) is that include does not give any error if there is some problem in file loading, it gives only a warning. But require ( ) gives a fatal error if file not found or something went wrong in file loading.Sometimes require ( ) is useful than include ( ) because we don't want to execute our PHP script continuously after occurring some problem at run time. Since require ( ) stops the execution of script, so it is useful in some cases.

CHAPTER 6 PHP WITH WEB DESIGN

6.1 HTML Forms with PHPThere is a form tag < form > available in HTML for input forms.For retrieving form's information like user inputs, PHP provides special built in variables for handling forms - they are $_POST and $_GET variables.$_POST : It is used for collecting values from a form with using method = post. The information which is sent by a form using the post method is hidden to others and has no limitation on the amount of information to send. $_GET : It is used for collecting values from a form with using method = get. Working of $_GET is similar to $_POST, but accessing input elements through $_GET is something different because the user input displays at URL area, so when sending some sensitive information like passwords we always use $_POST.$_REQUEST : It is also a predefined variable of PHP, which contains the content of $_POST, $_GET and $_COOKIE. It can be used for collecting data with both $_POST and $_GET.Example :< html>< body >< form action = " test.php " method = " post "> Student Name : < input type = " text " name = " name " > < br > Father's Name : < input type = " text " name = " f_name " > < br > Email ID : < input type = " text " name = " email " > < br > Mobile Number : < input type = " text " name = " mobile " > < br > < button type = " submit " > Submit < / button >< / body >< / html >

Output :

Fig. 6.1a

When a user fills put the form above and clicks on the submit button, the form's information is sent to a PHP file, called test.php :< ?php print " < b> Name : < /b > " . $_POST [ ' name '] . " < br > "; print " < b> Father's Name : < /b > " . $_POST [ ' f_name '] . " < br > "; print " < b> Email ID : < /b > " . $_POST [ ' email '] . " < br > "; print " < b> Mobile Number : < /b > " . $_POST [ ' mobile '] . " < br > "; ?> Output :

Fig. 6.1b

6.2 Creating Connection with MySQL Database There is a predefined mysqli_connect() function available in PHP for making connection with MySQL database.Syntax :mysqli_connect ( host_name, user_name, password, database_name ) ; HostName : Hostname or an IP address. It is an optional parameter. UserName : Username of MySQL. It is also an optional parameter. Password : For security purpose, use a password of database. It is also an optional parameter. DatabaseName : Name of the database. It is also an optional parameter.Example :

6.3 Closing ConnectionWhen script ends, connection will be closed automatically. For closing the connection, there is a predefined mysqli_close ( ) function available in PHP.Example :

6.4 Creating HTML form using MySQLYou can accept values from an HTML form and store all the values in to the database. For this we have to create a database, as we already installed XAMP or WAMP so no need to do anything extra.Following are the steps to create a HTML form :Step 1 :Go to address bar and open " http : // localhost / phpmyadmin / ". Now a webpage will open of Administrator.Step 2 :Here we have to create a database : create a database " my_db "; Step 3 :After creating database, create a database table namely students. For this execute following SQL query :CREATE TABLE students ( first_name VARCHAR (30), last_name VARCHAR (30), city VARCHAR (30)) ;Step 4 :Create an HTML form " test.html " ;< html >< body >< form action = " test.php " method = " post " >First Name : < input type = " text " name = " first_name " > Last Name : < input type = " text " name = " last_name " >City : < input type = " text " name = " city " >< input type = " submit " >< / form>< / body >< / html >

Step 5 :Create a PHP script for MySQL connectivity :