FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Poll software recommendations
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Poll software recommendations... resolved [message #176228 is a reply to message #176227] Thu, 08 December 2011 18:11 Go to previous messageGo to previous message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma:
Senior Member
rataplanpupum wrote:
>
>> There's not that much to it. Last time I wrote a poll the whole thing
>> took less than half a day.
>>
>
> oh... wounderful...

Mine took a bit longer..the graphic artist wanted pretty colors and bars
on it..


Here's the display bit of it..assumes an open database with values of
for against neutral and didn't vote at all (NULL) in it

The databases insertion is just from a form..


function display_votes($x,$y)
{
$maxwidth=100; // simple enough.
$framey=$y+40;
$framex=$x-15;
//
?>
<div style="position: absolute; top:<? echo $framey -48; ?>px; left: <?
echo $framex ?>px; width: 180px; color:#47295C; text-align: center;
font-weight: bold;font-style: italic;font-size:8pt ">
Are you against, for, or neutral about this development?</div>

<div style="position: absolute; top:<? echo $framey; ?>px; left: <?
echo $framex ?>px;"><img src="images/Pollometer.gif" border="0";
alt="poll-o-meter bezel"></div>

<?
$y+=50;
$x-=25;
// get pixel width of the three possible results. We ignore those who
didnt vote (yet)
$neutral=mysql_result(mysql_query("select count(voted) as total from
people where voted='neutral'"),0,'total');
$for=mysql_result(mysql_query("select count(voted) as total from
people where voted='for'"),0,'total');
$against=mysql_result(mysql_query("select count(voted) as total from
people where voted='against'"),0,'total');
$total=$against+$for+$neutral;
$forx= round(($for/$total) * $maxwidth);
$neutralx= round(($neutral/$total) * $maxwidth);
$againstx= round(($against/$total) * $maxwidth);
/*$forx=10;
$neutralx=7;*/
// Right. Now draw three coloured bars.
?>
<div style="Position: absolute; left:<?echo $x+20?>px;top:<? echo
$y?>px; height: 10px; width:<? echo $againstx?>px;
background-color:#BD3880;"></div>
<div style="Position: absolute; left:<?echo $x+20?>px;top:<? echo
$y+15?>px; height: 10px; width:<? echo $forx?>px;
background-color:#000080;"></div>
<div style="Position: absolute; left:<?echo $x+20?>px;top:<? echo
$y+30?>px; height: 10px; width:<? echo $neutralx?>px;
background-color:#505050;"></div>
<div style="Position: absolute; left:<?echo $x+20?>px;top:<? echo
$y?>px; height: 10px; width:100px;text-align:center; color:#FFFFFF;
font-size: 7pt"><?echo $againstx?>%</div>
<div style="Position: absolute; left:<?echo $x+20?>px;top:<? echo
$y+15?>px; height: 10px; width:100px;text-align:center; color:#FFFFFF;
font-size: 7pt"><?echo $forx?>%</div>
<div style="Position: absolute; left:<?echo $x+20?>px;top:<? echo
$y+30?>px; height: 10px; width:100px;text-align:center; color:#FFFFFF;
font-size: 7pt"><?echo $neutralx?>%</div>
<div style="Position: absolute; left:<?echo $x+125?>px;top:<? echo
$y?>px; height: 10px; width:100px;text-align:left; color:#FFFFFF;
;font-size: 7pt">Against (<?=$against?>)</div>
<div style="Position: absolute; left:<?echo $x+125?>px;top:<? echo
$y+15?>px; height: 10px; width:100px;text-align:left; color:#FFFFFF;
font-size: 7pt">For (<?=$for?>)</div>
<div style="Position: absolute; left:<?echo $x+125?>px;top:<? echo
$y+30?>px; height: 10px; width:100px;text-align:left; color:#FFFFFF;
font-size: 7pt">Neutral (<?=$neutral?>)</div>
<div style="Position: absolute; left:<?echo $framex?>px;top:<? echo
$y+50?>px; height: 30px; width:180px;text-align:center; color:#FFFFFF;
font-size: 8pt">Poll Results:<? echo $total?> votes cast</div>
<div style="position: absolute; top:<? echo $framey +90; ?>px; left: <?
echo $framex ?>px; width: 180px; color:#47295C; text-align: center;
font-style: italic;font-size:9pt ">
<A HREF="contact-1.php" target="_self">Contact us to register and
vote</a></div>

<?
}
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Warning: Install folder still exist!
Next Topic: <beg> ADODB PHP Extension Help </beg>
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Mon Nov 25 23:57:50 GMT 2024

Total time taken to generate the page: 0.04064 seconds