Simple PHP tasks to practise

Try the following

When you feel that you know php and you like to practice a bit of programming, you will find few useful list of tasks here.

To do the following tasks you should know :

php, html forms, passing post and get variables to the same php page or to a different php page. You should also know how to receiving those php variables.

Work out the tasks

Each set of task when worked out solo, you will reveal few ideas. Always learn programming languages practically. You can use these simple tasks to practise javascript too :-)

In the end of the page find my email for you to send your zip file to me to check your code and we can discuss more. I can direct you through the right path if I find some mistakes in your code. Feel free to do as many mistakes as you can, You will learn from it. Please do not send your files with known errors ! Make comments where ever necessary so that I can understand your code better. It would be much better if

During practising these tasks I am sure you will learn a lot of inbuilt php functions that you would not have thought of.

Tasks set 1: The complexity increases as you go down the numbers

1. Find the biggest among 5 and 7

 - You can get inputs from a form and display the result in the same page and next page 
 - please try displaying in same page and next page.

extend to display biggest among three given number
extent to display the smallest among the three numbers too

Remember you need to code only at your display for the extended tasks
Use arithmetic, comparison operators and few conditional operators.

2. Find if the given year in a leap year or not

 - get input from user through a form validate it to be a year.

 - display the result if the given year is a leap year or not.

3. Display a loop

 - get start and end year from the user and display from lowest year to the highest. eg: if start : 1920 and end : 1930 the display would be from 1920..1921 so on till 1930
 - extend this task and try in all different loops(for, while, do-while,) that you learned in your tutorials.

4. Display the following – conditions

 - if today is monday and tuesday and wednesday - display “we are going to school”
 - if today is monday - display ”we will be learning mathematics”
 - if today is tuesday or wednesday - display “we will be learning physics”
 - if today is thursday or friday - display “We will be on a practical class”
 - if today is saturday or sunday - display “We are on a holiday”
 HINT : 
for monday remember you will have to display both the following : “we will be going to school, we will be learning mathematics” - use logical operators along with string concat and few other previously used and needed operators too.

5. Find the age

 - Get date of birth from the user and find how many years he is old now.
 - extend this to narrow down to how many years, months, weeks, days old he is. eg: You should display something like “You are 16 years 4 months and 3 days old"


Hope I have triggered your thoughts a bit, more set of tasks to be listed here soon and you can improve your programming skills with it.

By now you should have come across many useful php functions, you should be knowing all operators(arithmetic, logical, comparison, … ) and loops (for, while and do-while). Please comment back how you found this task list so that I can post more complex tasks for you to try, Thanks.

Please email your codes for evaluation to, compress and send files in zip format.

Why CSS ?

Cascading style sheet

If you do not know how to create an html page please go HERE and learn it out first, which out html, CSS has nothing to do.

On earlier html versions pure attributes were decorating any html element. The CSS2 was good and did a lot of job, decorating the html element and made a web page light weight. Now CSS3 is doing an awesome work with LESS and SASS.

Let’s learn LESS and SASS later, lets see what CSS does first and how.

How css works

Css can be defined in three methods :

  1. inline
  2. internal
  3. external


<p style=”color: red”>Hello World</p>

Here style is the inline attribute used to define css styling in the “P” element itself. “Color” is a css property to which the valuered” is assigned. Now the “Hello World” will be in red colour. There are a lot of css property that you will need to master, you can find good tutorial links at the end of this blog for references.


The following code when defined within the head tag is said as internal styling.

p {
color: yellow;

Remember to use the style tag.


Save the following code in a style.css file and include this in your head with a link tag. Remember you will not be using style tag here.

p {
color : blue;
use this link tag within your head tag : 
<link rel="stylesheet" href="path-to-filename/style.css">

Assume I have done all the three methods in html file and you can see I have given different colours for the same “p” tag.

Now my question what color will the “Hello World” be ?

Answer is : red

Why ? Because styling has a hierarchy priority built from inline to internal then to external.

Meaning : the external style overwritten by internal and that is again over written by inline styling.

View the changes

Open your html file in any browser and it should show you the output.

Tutorials Guides

Learn most of the css property at



Conclusion :

  • You have learnt how to work with CSS.
  • You got some splendid guide on the tutorials to follow.

Follow more of my blog posts, and become a perfect web developer.

Building your first html page

Have you decided to become a web designer ?

A web designer’s first foremost subject to master is HTML. Hyper Text Mark-up Language is a Mark-up language that is highly used in web page designing. You can learn with a lot of tutorials available online. Here I am not going to teach you any html, I am just guiding you through in building your first html page, because few of the tutorials doesn’t teach you how to do/code an html page, it just blindly starts up with the tags and attributes.

Along with creating the html file you will also know about :

  1. The Editor
  2. The Browser
  3. Tutorial Guides

The Editor

To create a html page you need a editor to type in the html codes. The following software list will help you type in your htmls.

  • notepad, notepad++ for windows
  • gedit for linus based operating systems
  • textedit for mac

The above listed editors are only the basic html editors, there are other editors that is useful when you are an advance html developer.

Open the editor type the following code

<title>My first Page title</title>
<h1>Wow! My First Page is working cool :-)</h1>

The above html code has some codes missing factors like doctype, lang attribute etc which you will learn in any tutorial links listed far below. Why did I create the code with few mistakes? I want you to learn html and learning always starts with some mistakes :-). Save the page as mypage.html in your desktop or any other drive which is comfortable for you.

Testing the page :

Yeah testing eventually means viewing the page. Before Viewing a page you need to know something about browsers.

The Browser :

A browser is a software used to view markup languages like html, xml and most of the web pages which has dynamic content through php, and more.
Few of the leading browsers are mozilla firefox, google chrome, internet explorer, safari, opera. Each operating system has its own default browsers which you can use to view your first page.

Viewing the page :

  • Right click on mypage.html file that you created, click on the option to view on the browser.
  • Open a browser, click file->open and direct to the mypage.html file and click open and it should open it.
  • Click drag drop the mypage.html page into the already opened browser which will also open the page you created. The page should look like the following image.


Tutorials Guides :

There are a lot of tutorials available online, but not all of them are good to follow for a new bee. The following websites are the best for a new html learner.

There are few other interactive tutorials like codecademy and more for advance html learners. You need not create any html page you can test all the tags and attributes directly on those web pages. Confusing, just ignore this paragraph and come back again later when you are really good with html.

Conclusion :

  • You have learnt how to create an html page.
  • You also have learnt how to open up the html page in the browser.
  • You got some splendid guide on the tutorials to follow.

Follow more of my blog posts, and become a perfect web developer.