Return to Information

Radio Control Info Poll Results

[insert_php]
//Set Values
$Height = 20 ; // Graph Height and Width
$WidthMax = 200 ;

$View = (int)$_GET[‘view’];
$Poll_ID = $_POST[‘item’] ; // This Value is the Poll ID “Item” Number.
$Poll_Answer = $_POST[‘poll’] ; // This is the Answer Submitted

// Check for values
if (!$View) {
if ( $Poll_ID < 1) { header('Location: /information/polls/?e=3'); exit(); } elseif ($Poll_Answer < 1 ) { header('Location: /information/polls/?e=2'); exit(); } } else { $Poll_ID = $View ; } // Establish Database Connection include $_SERVER['DOCUMENT_ROOT'] . '/includes/database.php'; // Retrieve Question and Poll Answers $Answers = 2 ; $result = mysql_query('SELECT * FROM PollQ WHERE item = '.$Poll_ID.' '); $row = mysql_fetch_array($result) ; $Question = $row['question']; $Ans1 = $row['A1']; $Ans2 = $row['A2']; $Ans3 = $row['A3']; $Ans4 = $row['A4']; $Ans5 = $row['A5']; if ( $Ans3 != '' or $Ans3 != 0 ) { $Answers = 3 ; } if ( $Ans4 != '' or $Ans4 != 0 ) { $Answers = 4 ; } if ( $Ans5 != '' or $Ans5 != 0 ) { $Answers = 5 ; } // Enter Database to retrieve Current Poll data $result = mysql_query('SELECT * FROM PollA WHERE item = '.$Poll_ID.''); $row = mysql_fetch_array($result) ; for ($i = 1; $i <= $Answers; $i++) { ${A.$i} = $row['A'.$i] ; } //Enter Results in to data base if (!$View){ ${A.$Poll_Answer} = ${A.$Poll_Answer} + 1 ; mysql_query('UPDATE PollA SET A'.$Poll_Answer.' = '.${A.$Poll_Answer}.' WHERE item = '.$Poll_ID.' '); } //Add values $TheSum = 0; for ($i = 1; $i <= 5; $i++) { $TheSum = $TheSum + ${A.$i} ; } if($TheSum ==0) { $TheSum = .0001 ;} // Close Database Connection mysql_close($con); // Pixel Width for ($i = 1; $i <= $Answers; $i++) { ${Per.$i} = round(${A.$i} / $TheSum * 100 , 0) ; ${BarWidth.$i} = floor(${A.$i} / $TheSum * $WidthMax); } // Create Table if($Question != '' or $Question != 0 ) { $Table = '

‘.$Question.’

‘;
for ($i = 1; $i <= $Answers; $i++) { $Table = $Table .'

‘;
}
$Table = $Table .’

Answer Graph %
‘.${Ans.$i}.’
‘.${Per.$i}.’

‘; }
else { $Table = ‘

Ooooops!!! – Table Does not Exist

 

 

‘; }

[/insert_php]

Radio Control Poll

 

Below you will find the poll results for the poll you have submitted.

Return to the Poll Page.

 

 

[insert_php] echo $Table ; [/insert_php]

Total number of votes are: [insert_php] echo ‘ ‘.round($TheSum,1) ; [/insert_php]

[insert_php] if(!$View) {echo ‘

You voted for: ‘.${Ans.$Poll_Answer}.’

‘ ; }[/insert_php]