/    Sign up×
Community /Pin to ProfileBookmark

Template for Poll

Hi everyone,

I’m trying to make a poll in php. For this I made a template.
It looks a bit like this (on the user side)

Question
o Awnser 1
o Awnser 2
o Awnser 3
o Awnser 4
o Awnser 5

Now I can edit the question and awnsers trough my admin page the problem is i dont always got 5 awnsers it’s a max. So somewhere in my template i must say something like: Only view when there is a awnsers. couse now if i got 3 awnsers is displays the 3 good and then “awnser_4” and “awnsers_5” . Anyone got any idears. Tnx in advance

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@shimonMar 19.2004 — I can't imagine this being too difficult - just a couple of 'ifs' - but how you do this rather depends what your code looks like to start with, where your questions are coming from (database?) etc etc.

Hmm...but then i guess if you have a nice template, you probvably dont want lots of php in there...

Can we have a look?
Copy linkTweet thisAlerts:
@BonnerMar 19.2004 — This could be done with a flat file system using line breaks and tabs.

Each line break representing an option and a tab for each vote.

This would be a very space savaing way of creating a poll.

You would explode the tabs and count them and then you would count the lines. You could even include the options for the poll in the file that stores all the results.

I use a similar technique for a guestbook I made.
×

Success!

Help @troy1984 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.4,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...