Jump to content

Multiple POLLS on one page? Can I do this?


aaricwon

Recommended Posts

I am making a page on this site that shows the fight card for a martial arts event.

 

basically a list of who is fighting who

 

you can see the start of it http://www.bjjnews.org/tuffnuf/index.php?option=com_content&task=view&id=52

 

I would like to have it so you can vote who you think will win. basically click on the name of the fighter you think will win.

 

I would like to have that for each match listed...

 

I can't figure out how

Link to comment
Share on other sites

<php

$id=isset($_GET['id'])?intval($_GET['pollid']):0;
$vote=isset($_GET['vote'])?intval($_GET['vote']):0;
$returnto=isset($_GET['returnto'])?$_GET['returnto']):'/';

@mysql_query("UPDATE polls SET hits=hits+1 WHERE pollid=$id AND vote=$vote");

$returnto=url_parse($returnto,PHP_URL_PATH);
$returnto=(file_exists($returnto)?$returnto:'/');
header("Location: $returnto");
?>

 

very simple script, the question is how yer polls section is setup, so mysql_query shud be altered for this.

 

so can be called from any page with

votefor.php?id=xxx&vote=yyy&returnto=zzz

 

where

xxx = Poll ID

yyy = Vote

zzz = current page/script to return to after updating the polls

 

Link to comment
Share on other sites

it maybe just a smiple code

 

eg

vote.php?match={MATCH_ID}&winner={WINNER_NAME_OR_ID}

 

and in the vote.php you want to add some cookies to stop flooding as this type will give another vote by just refreshing the page !!

 

this will be like what laffin said above, with thanks to him :)

 

 

personnally, I would like to prefere AJAX, safer and more interactive, they may click on the fighter, then a new space will shows with loading ( or animated gif ) and then loads the result directly in the same place.. to give you an example, just see the poll in this site, there's no need to refresh the page or load another page, in the same page the vote & results too, if the user clicked, then the links will be replaced by poll results so he wont be able to vote again unless he refreshed the page, but you can use cookies here to see if this guy voted before or not :)

 

http://blog.se-nse.net/ - poll is in the left side second from top...

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.