How to Create HTML Code for Web Polls

Introduction
To develop a web poll you need to keep in mind that there should be four basic parts that should be included in any piece of HTML code for web polls. The first of these basic parts is the question that will be asked to the users.
The second is a multiple choice list of questions to choose from where the users should be restricted to choosing only one question.
The third item that must always appear in a HTML web poll is obviously a way of submitting the user answers. This is mostly achieved in the form of a HTML push button. There should then be a part of the web poll that is responsible for showing the results back to the user.
Finally you need a place to save the results of the HTML web poll. This would usually be a database stored on a web server.
The HTML Code
Let us get started with writing the HTML code for web poll. This will consist of a web form and a result panel. To create the web form you use standard HTML tags to create the form to hold the list of radio buttons that will represent the answers. Finally there should be a panel which will hold a list of the answers as placed by the other users in the form of percentages.
This is some sample HTML code for displaying the form.
Poll
Do you like web polls?
Yes I do
No, I do not
I dont know
depends on the question
This is as simple as it gets. Then there is the code template that represents the answers in the form of percentages based on the collective answers of the users. Take note that the HTML code below needs to be loaded dynamically based on the actual answers so that it can reflect the actual results.
Poll Results
Putting It All Together
Unfortunately, as beautiful as the HTML code above looks, it will be pretty much non-functional without the help of some server-side code to process the data collected. The reason is that HTML forms are designed to collect data but not to process it.
To process the data collected through the web poll, you need to collect the data on the server and increment a counter stored in a database. Get the averages of the counters for all answers then respond with percentages of popularity of each question. This processing can be done on any web server in a language that is compatible with that particular web server. Regardless of the language used, the general process is standard. Here is some sample pseudo code the illustrates what happens when the user submits the web poll.
if( Success in Opening database ){
temp_id = ID from web form
Enter database and Extract all IDs
while( ID <= 4){
array_count = current vote count from database
If(ID == temp_id){
array_count = array_count + 1
}
ID = ID +1
}
ID = 1
while(ID <=4){
foreach(ID)
{
vote_count_percentage_array = (current vote count / total vote count)x 100
ID = ID +1}
ID = 1}
while(ID <= 4){
print “$Answer
print “$Answer$ vote_count_percentage_array[ID]”
lt;/B> vote_count_percentage_array[ID]”
ID = ID +1}
}else{
General Poll failure}
Conclusion
There are several variations to the way you can create web polls. Some include improving the appearance of the web poll by using JavaScript effects, graphics and dynamic data exchange using Ajax. Whichever method you choose to use, the methods described in this article form the basis for HTML code for web polls.