How to Write Polls in HTML

Syterion

Voodoo Economist
Joined
Nov 24, 2003
Messages
4,287
Location
San Diego, CA
Can't find any tutorial on this anywhere. Checked the source of a poll on this forum but it's very complicated and I can't read it.

Any help?
 
Polls cannot be done in plain html

you need either php or perl to do that, so search in a database for either of those.

The actual form you use for a poll is done with html tags though

This is IIRC, some of the basic tags you need to use for the visual part. If you know cascading stylesheets, you can style how it appears too.

Code:
<form>
<select>
<option>Add option here</option>
<option>Add option here</option>
</select>
</form>

You need to apply more to all of these tags, for them to work properly though.

For more info on these tags, try www.w3c.org
 
as Paalikles said, you'll need a database backend before you can conduct a poll. the actual poll display html (ie radio buttons) is very easy.
 
as in a quiz?
you could make one of them without a database, although it would be more efficient with the database i imagine. it's not really a poll. a poll would be offering several choices and recording selections people have submitted.
 
if you don't want to store anything, you don't really need a database, but it's much cleaner coding if you do.

you can store your information in a session-cookie (eg. in php), but that way you'll only have the information from one user. so you can't do these "what/who would you chose" kind of polls, but for a quiz it should work that way.
 
I suppose it is doable via javascript and cookies - but you probably cannot produce output from polls that will last for a long time.

For database, I suppose mysql or whatever is the best.

BTW - there are free poll services out there, which you can use to integrate in your website design! I had something called Alxpoll on an old website I created back in highschool. As long as the FORM info was intact, I could style the appearance of the poll myself, and I could configure the results page to some extent as well. Since databases requires quite a bit of know-how - I would recommend the prebuilt option for you - unless you are building a commercial website.

As always - google for it :)
 
You can use a *.txt file for the database, updated by a PHP or CGI script. Polls don't need anything fancy. Even huge polls with anonymous voting would have a tiny database.

You could even have the script update the HTML results directly.

HTML Form -> CGI Script -> HTML results
 
Back
Top Bottom