How it works

Now you’re seen the survey working, let’s go over what we’re going to do

  1. We’re going to make a HTML page with a form on it to collect data
  2. Before we send the data off to PHP to do clever stuff with, we’ll use some javascript to make sure that the user has filled in the whole form and give them an error message if they haven’t
  3. We’re going to send that data to a PHP page which will store the data in a database
  4. We’re going to read the data stored in the database and display it in a fun way using javascript

It might help to think about how you would do a survey in real life, with pens, paper and a trusty clipboard. You’d write a questionnaire and get people to fill it in. Then you’d collect all the questionaires up, tally up the answers and make sense of the answers you’ve collected.

We’re going to use HTML to create our form – nothing too crazy there, it’s not that different from if we wrote the survey by hand. We’ll formulate the questions, create things like tick boxes etc

The clever bit is that using a server side language like PHP and a MySQL database we can get the computer to do the hard stuff for us. We’ll send it the answers to our survey and our PHP code will store it and then we can easily sort and filter it.

At this point terms like ‘PHP’ and ‘HTML’ might be making your head spin. Don’t worry, we’ll explain them as we use them. Let’s get to work on our form and get collecting data