Forum Moderators: coopster

Message Too Old, No Replies

New Voting poll site, little help please.

Would like to know the best approach.

         

dkin

9:57 am on Dec 12, 2004 (gmt 0)

10+ Year Member



I am making a hair cut voting site where individuals post a pic of there new haircut and others can rate it. Now I have 2 questions at the moment, for the voting script should I use a script or just write some php and have all the figures in a database. And how can I get a random users pic displayed, should I just use a variable where the username will be in the url and add a random script to that?

Thanks for all of your help.

Cheers.

dreamcatcher

12:40 pm on Dec 12, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



A rating system should be fairly easy to do. You might want to use cookies if you only want users to vote once. As for your random image, use the rand() function and pull one random image. Assuming your image data is in a database, you would need something like:

SELECT userimage FROM images ORDER BY rand() LIMIT 1

dc :)

dkin

3:51 am on Dec 13, 2004 (gmt 0)

10+ Year Member



Ok, for the voting portion I have 10 radio buttons. Each with a value 1-10 but I would like the value submitted as soon as the button is pushed, I know this is probably javascript but I need it to work with my php so Im hoping someone can help me out.

This is my tiny form.

<form action='<?php $php_self?>' method='post'>
1 <input type='radio' name='score' value='1'/>
2 <input type='radio' name='score' value='2'/>
3 <input type='radio' name='score' value='3'/>
4 <input type='radio' name='score' value='4'/>
5 <input type='radio' name='score' value='5'/>
6 <input type='radio' name='score' value='6'/>
7 <input type='radio' name='score' value='7'/>
8 <input type='radio' name='score' value='8'/>
9 <input type='radio' name='score' value='9'/>
10 <input type='radio' name='score' value='10'/>
</form>