You are on page 1of 40

Final Project Report

Get Physical Trainer

Project Supervisor
Ahmed Hannan

Submitted By

F20023C6B8

Saira Shahzad MC190401323

Software Projects & Research Section,


Department of Computer Sciences,
Virtual University of Pakistan
CERTIFICATE

This is to certify that Saira Shahzad MC190401323have worked on and completed


their Software Project at Software & Research Projects Section, Department of
Computer Sciences, Virtual University of Pakistan in partial fulfillment of the
requirement for the degree of BS in Computer Sciences under my guidance and
supervision.

In our opinion, it is satisfactory and up to the mark and therefore fulfills the
requirements of BS in Computer Sciences.

Supervisor / Internal Examiner

Ahmed Hannan
Supervisor,
Software Projects & Research Section,
Department of Computer Sciences
Virtual University of Pakistan

___________________
(Signature)

External Examiner/Subject Specialist


<<External Supervisor Name>>

___________________
(Signature)

Accepted By:

_____________
(For office use)

EXORDIUM
In the name of Allah, the Compassionate, the Merciful.

Praise be to Allah, Lord of Creation,


The Compassionate, the Merciful,
King of Judgment-day!

You alone we worship, and to You alone we pray for


help,
Guide us to the straight path

The path of those who You have favored,

Not of those who have incurred Your wrath,


Nor of those who have gone astray.
DEDICATION

I dedicate this project and report to my Parents, family members


and my friends, who support me in every situation of life and
especially they taught me that practically, how to work hard to
achieve goals in life.
ACKNOWLEDGEMENT

Ahmed Hannan has been best supervisor for me. In the


starting of this project, in certain points, I totally lose hope
then he gave me hope to work hard and guide to
completing my final project.

Finally, I am highly indebted to Virtual University of


Pakistan for their valuable knowledge, teaching and
constant supervision.
PREFACE

Learning comes from doing. To learn something, one has


to go through practical conditions. Recognizing this fact,
the university made it essential for students of BSCS to
make a project. During this period, student learns about
functioning of the project and the actual environment. In
addition, this training helps the student how to implement
theoretical knowledge into practical life, in our day-to-day
daily life.
This report was special emphasis on operational work,
tasks and projects carried out during the development
period.
The mean reason of choosing this project for me that, this
project focuses on problem solving in easy manner.
Therefore, through this project we will help many people
and build a better and educated society.
Finally, I would thanks to everyone who, guide and
support me for completing this project.
TABLE OF CONTENTS

CHAPTER NO. 1
GATHERING & ANALYZING INFO..........................................................................10

1.1 INTRODUCTION

1.2 PURPOSE

1.3 SCOPE

1.4 DEFINITIONS, ACRONYMS AND ABBREVIATIONS

1.5 PROJECT REQUIREMENTS

1.5.1 Functional Requirements

1.5.2 Non-Functional Requirements

1.6 USE CASES AND USAGE SCENARIOS

1.6.1 Use Case Diagrams

1.6.2 Usage Scenarios

1.7 DEVELOPMENT METHODOLOGY

1.7.1 Chosen Methodology

1.7.2 Reasons for Chosen Methodology

1.7.2 Work Plan (Gantt Chart)

1.7.2 Project Schedule (Submission Calendar)

CHAPTER NO. 2
DESIGNING THE PROJECT.......................................................................................12

2.1 INTRODUCTION
2.2 PURPOSE

2.3 SCOPE

2.4 DEFINITIONS, ACRONYMS AND ABBREVIATIONS

2.5 ARCHITECTURAL REPRESENTATION (ARCHITECTURE DIAGRAM)

2.6 DYNAMIC MODEL: SEQUENCE DIAGRAMS

2.7 OBJECT MODEL/LOGICAL MODEL: CLASS DIAGRAM

2.8 DATABASE MODEL (DATABASE DIAGRAM)

2.9 GRAPHICAL USER INTERFACES

CHAPTER NO.3
DEVELOPMENT............................................................................................................13
3.1 DEVELOPMENT PLAN (ARCHITECTURE DIAGRAM)
CHAPTER 1
Gathering & Analyzing Info
1.1 INTRODUCTION

Get Physical Trainer is an online portal which will help users to search, join and
keep in touch with trainers online. Trainers will get registered on the portal with
the required information. Users will be able to search a trainer through different
filters like fee, location, experience and timings.
User will be able to sort the trainers through their ratings. User can contact a trainer
through built in system chat so they will be able to communicate without the
involvement of other applications. User will also get benefit of receiving physical
health tips from their trainers. Administrator of the application will have an
overview of all the system.

1.2 PURPOSE
Physical trainers help users to perform exercises with correct techniques,
minimizing the risk of injury. While some discuss nutrition, ergogenic
supplementation, and spiritual practices with user, there is debate within the
industry as to whether it fits within their scope of practice
and training qualifications.

1.3 SCOPE

The Aim of this system is facilitating the users to get in touch with Trainers at any
time anywhere. The use of Internet and computing devices is increasing day by
day. There are many types of service providers across the country. It is the need of
today’s era that these service providers adapt technology and digitalization. Fitness
Trainer, or Fitness Instructor, provides fitness guidance to help clients improve
their physical condition. You will assess the physical and health conditions of
clients, create appropriate exercise plans, and monitor their improvement. You will
also explain applicable safety rules and regulations. User will be able to sort the
trainers through their ratings. User can contact a trainer through built in system
chat so they will be able to communicate without the involvement of other
applications.

1.4 DEFINITIONS, ACRONYMS AND ABBREVIATIONS

 HTML (Hyper Text Markup Language)


 CSS (Cascading Style Sheet)
 PHP (PHP Hyper Text Markup Language)
 DBMS Database Management System)
 SQL (Structure Query Language)
1.5 PROJECT REQUIREMENTS

1.5.1 Functional Requirements

Administrator:
 Administrator will have an overview of all system through dashboard.
Maintain System rules and roles.
 Administrator will be able to update and delete registered trainers/users
who will approved by admin.

Trainers:
 Register in the portal with their personal details and some other
information like their fee, location, experience and working hours.
 Update their information like name, email, contact, address, location,
experience etc.
 List of their joined users who can approved by administration.
 Send physical health tips to all joined users with all detail.
 Contact their joined users through chat system. For providing quickest
methods of customer service .

Users:
 Register in the portal with personal information like name, email, contact,
address, etc.
 See a list of trainers depending upon fee, location, experience and working
hours they pay great services.
 Contact a trainer through chat system with messages.
 Join a trainer for getting their services.
 Give and update review for their trainer with detail.
 Update their information like name, email, contact, address, etc.
 Receive physical health tips from their trainer.

1.5.2 Non-Functional Requirements

Those requirements, which not specified by system but software, will perform
those how to do tasks are referred as non-functional requirements. Following
are the non-functional requirements of project.

Performance: System should perform all of its functions excellently and


effectively without any inconvenience.
Reliability: System should be reliable or flexible for user to feel free about
security needs.
User Friendly interface: System Software design should simple and user
friendly so user can understand it and perform functions easily.
Usability: Usability of System must be easy so that User can use it without any
difficulty.
Flexibility: System must be flexible so that it can easily accept all changes at
low cost, time and experience.

1.6 USE CASES AND USAGE SCENARIOS

1.6.1 Use Case Diagrams

Get Physical Trainer


Registration

Login

Update profile

Jooined User

<<include>>

Send Tips
Trainer

Contact

Manage Users

User
Overview System

Trainer list

<<extend>> <<extend>>

<<include>>

See Receive Tips

Join

Administrator

Trainer's Rewiew

LogOut

1.6.2 Usage Scenarios


Use Case Title Registration
Use Case Id 1
Description: Get physical Trainer Web Based Application should running in web
browser. The system will allow user to sign up from application.
Pre-Conditions: The web-based application is running on the system
Task Sequence Exceptions
1. Select register option. Email address is not
2. Enter the required information on the form. valid
Invalid password
Post Conditions: The registration page is appearing on the screen.
Unresolved issues: Email address is not valid / Invalid password
Authority: User/Trainer
Modification history: 1.0

Author:
Mc190401323

Use Case Title login


Use Case Id 2
Description: Get physical Trainer Web Based Application should running in web
browser. The system will allow user login into the application.
Pre-Conditions: The web-based application is running on the system
Task Sequence Exceptions
1. Select login option. Wrong mail or
2. Enter the required information on the form. password
Post Conditions: The login page is appearing on the screen.
Unresolved issues: Email address is not valid / Invalid password
Authority: Admin, User/Trainer
Modification history: 1.0

Author:
Mc190401323

Use Case Title Update profile


Use Case Id 3
Description: Get physical Trainer Web Based Application should running in web
browser. The system will allow user/Trainer to update their profile into the application.
Pre-Conditions: The web-based application is running on the system
Task Sequence Exceptions
1. Select login option. we couldn’t update
2. Enter the required information on the form. information at that
3. Click profile button moment
Post Conditions: The profile page is appearing on the screen.
Unresolved issues: we couldn’t update information at that moment
Authority: Admin, User/Trainer
Modification history: 1.0

Author:
Mc190401323

Use Case Title Joined user


Use Case Id 4
Description: Get physical Trainer Web Based Application should running in web
browser. The system will allow Trainer to see joined user into the application.
Pre-Conditions: The web-based application is running on the system
Task Sequence Exceptions
1. Select login option. n/a
2. Enter the required information on the form.
3. Click joined user list
Post Conditions: The User page is appearing on the screen.
Unresolved issues: n/a
Authority: Trainer
Modification history: 1.0

Author:
Mc190401323

Use Case Title contact


Use Case Id 5
Description: Get physical Trainer Web Based Application should running in web
browser. The system will allow user/trainer to contact each other into the application.
Pre-Conditions: The web-based application is running on the system
Task Sequence Exceptions
1. Select login option. n/a
2. Enter the required information on the form.
3. User contact button for contact
Post Conditions: The contact page is appearing on the screen.
Unresolved issues: n/a
Authority: User/Trainer
Modification history: 1.0

Author:
Mc190401323

Use Case Title Over view


Use Case Id 6
Description: Get physical Trainer Web Based Application should running in web
browser. The system will allow admin to over view of the application.
Pre-Conditions: The web-based application is running on the system
Task Sequence Exceptions
1. Select login option. n/a
2. Enter the required information on the form.
3. Admin click the over view option of the system
Post Conditions: The User page is appearing on the screen.
Unresolved issues: n/a
Authority: User/Trainer
Modification history: 1.0

Author:
Mc190401323

Use Case Title Trainer list


Use Case Id 7
Description: Get physical Trainer Web Based Application should running in web
browser. The system will allow user to see trainer list.
Pre-Conditions: The web-based application is running on the system
Task Sequence Exceptions
1. Select login option. n/a
2. Enter the required information on the form.
3. User click the trainer list option
Post Conditions: The Trainer list page is appearing on the screen.
Unresolved issues: n/a
Authority: User
Modification history: 1.0

Author:
Mc190401323

Use Case Title Manage user trainer


Use Case Id 8
Description: Get physical Trainer Web Based Application should running in web
browser. The system will allow admin to manage user trainer.
Pre-Conditions: The web-based application is running on the system
Task Sequence Exceptions
1. Select login option. n/a
2. Enter the required information on the form.
3. Admin will manage tutor or trainer
Post Conditions: The manage user page is appearing on the screen.
Unresolved issues: n/a
Authority: admin
Modification history: 1.0

Author:
Mc190401323

Use Case Title Trainer review


Use Case Id 9
Description: Get physical Trainer Web Based Application should running in web
browser. The system will allow user to see review about a Trainer into the application.
Pre-Conditions: The web-based application is running on the system
Task Sequence Exceptions
1. Select login option. n/a
2. Enter the required information on the form.
3. User will check the feedback about trainer
Post Conditions: The feedback page is appearing on the screen.
Unresolved issues: n/a
Authority: User
Modification history: 1.0

Author:
Mc190401323

Use Case Title Logout


Use Case Id 10
Description: Get physical Trainer Web Based Application should running in web
browser. The system will allow user logout from the application.
Pre-Conditions: The web-based application is running on the system
Task Sequence Exceptions
1. Select logout option. n/a
2.
Post Conditions: logout successfully.
Unresolved issues: n/a
Authority: Admin/Trainer/User
Modification history: 1.0
Author:
Mc190401323

1.7 DEVELOPMENT METHODOLOGY

1.7.1 Chosen Methodology


Waterfall Model:

Advantages
 Simple and easy to understand and use
 Easy to manage due to the rigidity of the model. Each phase has specific
deliverables and a review process.
 Phases are processed and completed one at a time.
 Works well for smaller projects where requirements are very well understood.
 Clearly defined stages.
 Well understood milestones.

Disadvantages

 No working software is produced until late during the life cycle.


 High amounts of risk and uncertainty.
 Not a good model for complex and object-oriented projects.
 Poor model for long and ongoing projects.
 Not suitable for the projects where requirements are at a moderate to high risk
of changing. So, risk and uncertainty is high with this process model.
 It is difficult to measure progress within stages.

Spiral Model
Spiral model is one of the most important Software Development Life Cycle models,
which provides support for Risk Handling.

Advantages
 Risk Handling: The projects with many unknown risks that occur as the
development proceeds, in that case, Spiral Model is the best development model
to follow due to the risk analysis and risk handling at every phase.
 Good for large projects: It is recommended to use the Spiral Model in large
and complex projects.
 Flexibility in Requirements: Change requests in the Requirements at later
phase can be incorporated accurately by using this model.
 Customer Satisfaction: Customer can see the development of the product at
the early phase of the software development and thus, they habituated with the
system by using it before completion of the total product.

Disadvantages
 Complex: The Spiral Model is much more complex than other SDLC models.
 Expensive: Spiral Model is not suitable for small projects as it is expensive.
 Too much dependable on Risk Analysis: The successful completion of the
project is very much dependent on Risk Analysis. Without very highly
experienced expertise, it is going to be a failure to develop a project using this
model.
 Difficulty in time management: As the number of phases is unknown at the
start of the project, so time estimation is very difficult.

Vu Process Model

Adopted methodology for this project is VU process Model it is the combination of


both waterfall and spiral model it is also called hybrid approach of system development
and it help to maximize the quality of system and minimize the disadvantages and risk.
As our project is starting from requirements and analysis phase and going form design
and coding the next procedures and finally it is going for approval and also VU process
model has four phases which further divides the waterfall processes these processes are
in iteration until system meets to our project requirements so VU process Model is the
best fit for our project here is the diagram of VU process Model

1.7.2 Reasons for Chosen Methodology

As we know that ever model have advantages and also disadvantages in accordance
with the project requirements. We should choose the right type of the Model to
implement based on the scope of the software project. This depends on a number of
factors, some of which are the scope of the project, project budget, environment,
available resources. But after studying the requirements of the project we choose VU
process model which is a combination of waterfall and spiral models.

Following are the reasons for choosing this Methodology:

 The Spiral Model or the Spiral Development Model combines the best of the
both top down and bottom-up approaches and is specifically risk-driven. In
essence the Spiral Model is a combination of the classic Waterfall Model and
Risk Analysis.

 The Spiral Model provides a rapid development and at the same time,
incremental versions of the software application.

 The combination of Waterfall and Spiral Model provides an orderly sequence of


development steps and helps ensure the adequacy of documentation and design
reviews to ensure the quality, reliability and maintainability of the developed
software.

 Combination of Waterfall and Spiral models allows for feedback and creativity.

 In Spiral model, the project life cycle is divided into phases, and each phase is
executed in all of the iteration of the Spiral Model.

 Unlike the waterfall model, where milestones are reached in a very linear
manner, and you are not allowed to backtrack, the VU process model uses the
spiral model’s ability to perform iterations when needed.

1.7.2 Work Plan (Gantt Chart)


1.7.2 Project Schedule (Submission Calendar)

Sr. No Task Start date Closing date


1 SRS Fri 27 Nov, 2020 Fri 18 Dec, 2020
2 Design Document Sat 19 Dec, 2020 Mon 18 Jan, 2021
3 Test phase Tue 19 Jan, 2021 Thu 04 Feb, 2021
4 Final report Fri 05 Feb, 2021 Tue 06 Apr, 2021
CHAPTER 2
Designing the Project
2.1 INTRODUCTION

In design phase we focus on ‘HOW’ to do. It means how the problem will be
solved and which tools and techniques will be used. Much care is taken during the
design phase because any mistake in this phase could be very expensive to solve in
he later stage of the software development. The purpose of design phase is to plan
out a system that meets the requirement defined in the analysis phase.

This document designed to see what is to be built at its origin levels in order to
give a software expansion team an overall guidance of the architecture of the
software project. This phase surround:

 Entity Relationship Diagram (ERD)


 Sequence Diagrams
 Architecture Design Diagram
 Class Diagram
 Database Design
 Interface Design
 Test Cases

 Entity Relationship Diagram:

o Entity Relationship Diagram is a data model for describing a database in


an abstract model. It contains entities and their relationships. An entity
may be defined as a thing which is recognized as being capable of an
independent existence and which can be uniquely identified.

 Sequence Diagram
o Sequence Diagram is an interaction diagram that shows how processes
operate with each other. It shows the messages exchanges between
entities.

 Architecture Design Diagram:

o Architecture Design Diagram used to represent data in the form of


layers. It contains three layers’ data link layer, application layer and
business layer.

 Class Diagram:
o In Class diagram, we will describe the structure of Online Support
System by showing the system's classes, show their attributes,
operations or methods and relationships between classes or objects. In a
class, diagram classes represent both the main objects and interactions.

 Database Design:
o Database Design is a process of producing a detailed data model of a
database. It can be taken as the logical design of the base data structures
to store the data

 Interface Design:
o Interface Design is a GUI view of main software. It shows how our
Software Application will look like and how we interference with the
System.

 Test cases:
o In the test cases for the Online Support System are also given. A test
case in software engineering is a set of conditions or variables under
which a tester will determine whether an application or software system
is working correctly or not.

2.2 PURPOSE

This document is, written to give a complete description, while maintaining a


high-level view of the software so that documentation will reduce abstraction
effectively and gradually.

2.3 SCOPE

In analysis and design phase of a project we create a design document that is an


illustrative explanation of a software product. A software designer designs this
document in order to give a software development team an overall picture and
guidance of the architecture of the software project. It usually accompanies an
architecture diagram and has pointers to the detailed feature specifications of
smaller pieces of the design. A design document is practically required to
coordinate a large team under a single vision. Design document allowed team
members to mutually communicate with each other and to take early design
decision about the product to be developed.

2.4 DEFINITIONS, ACRONYMS AND ABBREVIATIONS

 HTML (Hyper Text Markup Language)


 CSS (Cascading Style Sheet)
 PHP (PHP Hyper Text Markup Language)
 DBMS Database Management System)
 SQL (Structure Query Language)

2.5 ARCHITECTURAL REPRESENTATION (ARCHITECTURE DIAGRAM)

2.6 DYNAMIC MODEL: SEQUENCE DIAGRAMS


:trainer/user :application :Database

fill registration informa tion()

Check va lidity ()

informa tion are valid ()

Successfully registe re d ()

X X

:Admin/trainer/user :application :Database

Enter ema il/ password()

Save info ()

check va lidity

databa se re sponse ()

login successfully()

X X
:Coder/Client :application :Database

check his/her profile

Update information()

Enter correct information()

Check va lidity()

Database save their information()

profile update successfuly()

X X

:trainer/user :application :Database

join user()

list user()

send tips to user()

database response()
join user successfully()

X X
:trainer/user :application :Database

check the ir use r/ trainer()

Show a ll records()

se nd me ssage for comunica tion()

contact successfully()

X X

:admin :application :Database

ove rview system()

Show a valia ble details ()

system overvie w succe ssfully()

X X
:user :application :trainer :Database

see trianer list()

join trainer()

sa ve all informa tion()

recive ve healty tips()

join trainer succefully

X X X

:admin :application :Database

manage user/trainer()
show all details ()

delete/update user/trainer()

Che ck va lidity()

Da taba se re sponce ()

manage successfully ()

X X
:user :application :Database

select trainer
show all details ()

give trainer's reveiw()


update trainer review()

Database responce ()

trainer's review successfully ()

X X

:Admin/trainer/user :application :Database

sele ct logout()

request send()

database response ()

logout succe ssfully()

X X
2.7 OBJECT MODEL/LOGICAL MODEL: CLASS DIAGRAM

Trainers Admin
-id: int -id: int
-name: string -name: string
-email: string -email: string
-password: string -password: string
-fee: string + view dashbaord ()
-working hours: string + manage users ()
Joined user list -experience: string + manage trainers ()
-id: int -trainer_id: int
-details: string + manage users ()
-health tips: int + send healthy tips ()
+ manage by Admin ()
Dashboard
+ tips send by trainer()
+ tips recieved by -id: int
joined users () -users: string
-details: string
-booking: string
+ view by admin ()

Users
Healthy tips
-id: int
-id: int -name: string
-details: string -email: string
-tips_id: int -password: string
+ tips send by trainer() -user_id: int
+ tips recieved by + recieve healthy tips
users () ()
+ manage by Admin ()
+ manage by trainer ()

2.8 DATABASE MODEL (DATABASE DIAGRAM)


Joined users

PK id

FK user_id

Details

Admin
Trainer
PK a_id
PK id
Name
FK trainer_id Email
Password

Name
email
Password
fee
working hour
experience
Dashbaord
Joined users list
PK id
PK id
Details
FK health tips users
booking

Details

User
Healthy Tips
PK id

PK id
FK users_id

FK tips_id
Name
email
Details Password

2.9 GRAPHICAL USER INTERFACES


CHAPTER 3
Development
3.1 DEVELOPMENT PLAN (ARCHITECTURE DIAGRAM)

Software Architecture Design is a crucial step for software and application developers
to describe the basic software structure by dividing functional areas into layers. It
depicts how a typical software system might interact with its users, external systems,
data sources, and services.

Software architecture is usually designed into four layers (some also make it three),
which are, from top to bottom, presentation layer, service layer, business layer, and
data layer.

0 Presentation Layer contains components for users to interact with the


application. It is responsible of processing user's input and returning the correct
response back to the user.
1 Business Layer includes the core business functionality of the application.
2 Data Layer is the lowest layer of an application. It is responsible of
communicating with the used data storage.
REFERENCES

Handout CS504 – Software Engineering - 1


Handout CS605 – Software Engineering - 2
Handout CS403 – DBMS
Handout CS508 – Modern Programming Languages
also by
W3schools.com website
Google and my friends helped me
APPENDIX
What is PHP?

PHP stands for PHP: Hypertext Pre-processor


PHP is a server-side scripting language, like ASP
PHP scripts are executed on the server
PHP supports many databases (MySQL, Informix, Oracle, Sybase, Solid, PostgreSQL,
Generic ODBC, etc.)
PHP is open source software (OSS)
PHP is free to download and use

What is a PHP File?


PHP files may contain text, HTML tags and scripts
PHP files are returned to the browser as plain HTML
PHP files have a file extension of ".php", ".php3", or ".phtml"

What is MySQL?
MySQL is a database server
MySQL is ideal for both small and large applications
MySQL supports standard SQL
MySQL compiles on a number of platforms MySQL is free to download and use
PHP + MySQL
PHP combined with MySQL are cross-platform (means that you can develop in
Windows and serve on a UNIX platform)

What do you need?

This tutorial will not explain how to install PHP, MySQL, or Apache Server.
If your server supports PHP - you don't need to do anything! You do not need to
compile anything or install any extra tools - just create some .php files in your web
directory - and the server will parse them for you. Most web hosts offer PHP support.
However, if your server does not support PHP, you must install PHP. Below is a link to
a good tutorial from PHP.net on how to install PHP5:

http://www.php.net/manual/en/install.php
Download PHP
Download PHP for free here: http://www.php.net/downloads.php
Download MySQL Database
Download MySQL for free here: http://www.mysql.com/downloads/index.html
Download Apache Server
Download Apache for free here: http://httpd.apache.org/download.cgi

Basic PHP Syntax:


A PHP scripting block always starts with <?php and ends with ?>. A PHP scripting
block can be placed anywhere in the document.
On servers with shorthand support enabled you can start a scripting block with <? And
end with ?>.
However, for maximum compatibility, we recommend that you use the standard form
(<?php) rather than the shorthand form.

Comments in PHP :
In PHP, we use // to make a single-line comment or /* and */ to make a large comment
block.

Variables in PHP:
Variables are used for storing values, like text strings, numbers or arrays.
When a variable is set it can be used over and over again in your script All variables in
PHP start with a $ sign symbol.

The Concatenation Operator:


There is only one string operator in PHP.
The concatenation operator (.) is used to put two string values together.

Conditional Statements:
Very often when you write code, you want to perform different actions for different
decisions. You can use conditional statements in your code to do this.

if...else statement:
use this statement if you want to execute a set of code when a condition is true and
another if the condition is not true.

else if statement:
is used with the if...else statement to execute a set of code if one of several condition
are true.

Looping:

Very often when you write code, you want the same block of code to run a number of
times. You can use looping statements in your code to perform this.

In PHP we have the following looping statements:

while - loops through a block of code if and as long as a specified


condition is true.
do...while - loops through a block of code once, and then repeats the loop
as long as a special condition is true.
for - loops through a block of code a specified number of times.
foreach - loops through a block of code for each element in an array.
PHP Functions
In this tutorial we will show you how to create your own functions.
Create a PHP Function
A function is a block of code that can be executed whenever we need it.
Creating PHP functions:
All functions start with the word "function()"
Name the function - It should be possible to understand what the function
does by its name. The name can start with a letter or underscore (not a
number)
Add a "{" - The function code starts after the opening curly brace
Insert the function code
Add a "}" - The function is finished by a closing curly brace
PHP Functions - Adding parameters
Our first function (writeMyName()) is a very simple function. It only writes a static
string.
To add more functionality to a function, we can add parameters. A parameter is just
like a variable.
You may have noticed the parentheses after the function name, like: writeMyName().
The parameters are specified inside the parentheses.

functionwriteMyName($fname)
{
echo $fname;
}
Why use $_GET?
Note: When using the $_GET variable all variable names and values are displayed in
the URL. So this method should not be used when sending passwords or other sensitive
information! However, because the variables are displayed in the URL, it is possible to
bookmark the page. This can be useful in some cases.

Note:

The HTTP GET method is not suitable on large variable values; the value cannot
exceed 100 characters.
The $_POST Variable:
The $_POST variable is an array of variable names and values sent by the HTTP POST
method The $_POST variable is used to collect values from a form with
method="post". Information sent the POST method is invisible to others and has no
limits on the amount of information to send.
Why use $_POST?
Variables sent with HTTP POST are not shown in the URL
Variables have no length limit

However, because the variables are not displayed in the URL, it is not possible to
bookmark the.

The $_REQUEST Variable :


The PHP $_REQUEST variable contains the contents of both $_GET, $_POST, and
$_COOKIE.

You might also like