Category Archives: HTML Tutorials

Using PHP to Handle HTML Forms

Right probably the moment most of you have been waiting for, getting input from users! fear not. This is not hard, in fact it is not as hard as i first imagined. Now i have said in the introductory pages that i am assuming some basic knowledge of HTML. So this would cover setting up forms etc.

If your not so confident with HTML then fear not its pretty straight forward and plus you could probably get something like Dreamweaver to do it all visually if you need to.

Right I hope you all know what a form is (if not, they are the text boxes etc that you fill in when you order something online etc)

OK enough babble, an example… Enter the following code into a new notepad file and save it as “form.php”.

The Form.


<form name="form1" method="GET" action="">

Email: <input type="text" name="email">

<input type="submit" value="Submit">


OK I will just explain a little more about the form, we have declared the form at the top using the <form> element, we have also set some attributes of the form, as in the way in which it will send data “method=GET” this means that we will send data via appending it to the URL or web address using querystrings – PHP automatically creates the $_GET array for you. This means any element on your form, once it is submitted will be available in the $_GET array. The same is true if you decide to send the form via POST. You will have a $_POST array to handle. The example below will clear this up.

Notice how we have not set the action element, we have just left it blank. This means that we will simply be sending the data to the same page it came from, whats called a postback. This means that we can put all our PHP code on the same page as the form. Not the most useful example, but i will expand it when we come to look at databases etc.

So all we are going to do is take the value entered into the form and make them into an email(mailto) link. So on the same page, lets tap in the following code:


if(isset($_GET['email'])) {

print ("Please send your email to <a href=\"mailto:$_GET['email']\">" . $_GET['$email'] . "</a><br>");



Ok what we have done is used a built in function of PHP to check if anything has been entered into the form of not. We use inset to set if the $email variable has been declared(created really) and if it has we print out some HTML with a link to the email address entered into the form and the actual contents of the form printed out.

Your end result should look something like this:

Notice how the actual email address is attached to the end of the URL in the address bar that is the query string. Because we have written the HTML output as a link when we click on the link it will initialize your email client as it should ready for an email to be sent to the specified address.

Tips for Creating A Health Web Site

Creating a website that works well is an important factor because it determines whether the website helps to grow your business or not. A website that breaks information in shorter sections, gives clear instructions, minimizes the use of jargons, and uses single mouse clicks can be effective. Ensure that enough space is allowed between clickable targets.

A good website should make use of font 12 and 14 that are easy to enlarging the texts. Use high contrast colors such as white and black. Ensure that it provides the speech function and the text versions for multimedia.

A website that makes use of appropriate typeface, writing style, navigation structure and accessibility features can easily be accessed and used by the older adults. In addition, it will look attractive to the younger users. An example would be this paleo website.

A good website should be user friendly -meaning that it should be organized in such a way that users can easily determine the information the site offers at a glance.  Users should be able to figure out the kind of information the link will lead them to. It should also direct the user where he can get the additional information he may be looking for and be able to return to the previously visited page with ease.

healthy webdesign

A health website is one whose structure is simple and straight forward.  If the site is simple and less complex, visitors will enjoy using it and will visit it again. If the information is broken down into smaller sections, it gives the visitors a specific amount of content at a time.  This makes it easier for them to grasp the information.

Ensure that related information is grouped together and the most important information located where visitors can easily find it.  This means that the website should have all the sections organized in a logical manner.  Think about how the adults will find the relevant information they may be looking for.  Provide a site map that shows the links to the site. If possible limit the number of points you make on a single page.

If there is any information you consider key, it should be put on the first page. This ensures that the visitors see and form an opinion on what the website provides. Other than having the most important information at the top, it is necessary that you keep paragraphs short. They should talk about one idea.

Ensure that your content is written in an active voice i.e. it should focus on people and actions. Also you should remember to have the content written in a positive and a friendly manner.  The content should have a detailed explanation and should not leave people guessing.

The web content should be written in the second person.  Make use of ‘’you ‘’, ‘’your’’ and ‘’we’’ Besides, you must remember that people who search for information on the website are very busy. They may not have all the time to go through the entire content.  Because of this, it is important that you provide a summary of the information to reinforce what is contained in the body.

If any of the information has to be repeated, ensure that it consistent.  If there is any contradiction, explain the reason for it.

Lastly, a good and a health website should have sufficient white space on the web page to ensure that it looks good. Put a space between the paragraphs.  Similarly, if there are clickable targets, ensure that you allow enough space between them to make it easy to hit the link. Make use of the commonly used fonts such as Ariel, Tahoma and Verdana.

Getting Started with PHP part 4

** Please check the documentation on the php website if you are having problems with installation. Or email me and i’ll be glad to help out.

To open up IIS and see what I’ve been banging on about you will need to go to Control Panel – Administrative Tools – Internet Information Services(IIS).

** I recommend making a short cut to this on your desktop.
OK when you first open IIS it should look something like this(Once you have expanded all the branches to the Default Website Level)

Internet Information Services - Default View

The to create a virtual directory, Right Click on the Default Web Site and go to ‘new’ – ‘Virtual Directory’.

Internet Information Services - Virtual Directory

Once to this stage we’ll move on to a new page.

Getting Started with PHP

So, Getting started with PHP huh? now you may have noticed that this site, was all made from .htm files. You are right in thinking that I made it entirley in HTML. The reason for this is simple, because I didn’t know any back then! Plus there are also some things we need to do before we start coding PHP.

The Following set of tutorials details how to set up your PC to start writing PHP scripts!

Right if you are the average windows user you will probably be supprised, like i was, to know that you can turn your PC into a web server for your own personal use, and if your on a network, others will be able to see your pages once you’ve made some.

So how do we do this?

Setting up Internet Information Services on Windows XP
OK, to start with, from your desktop, click the start button, settings, control panel.
In the control panel, select “Add/Remove Programs” and Click Windows Setup or add/remove windows Components

Add/Remove Components in the Control Panel - This is to make windows take a look at what<br /><br />
snap-ins are currently installed on your machine.
Add/Remove Components in the Control Panel – This is to make windows take a look at what snap-ins are currently installed on your machine.

A list of programs should appear, ones with ticks next to them are installed, ones without are missing.
Scroll down and put a tick next to Internet Information Services(IIS) and press next. Windows then does some jiggery pokery and installs IIS or the web server bit to me and you. Please note this is for XP pro users only and you will need your windows disk for this bit.

Boring Part 1 over – Lets get the things needed to do some PHP with!

You’ll need to check out Getting Started with PHP pt 2 for that!