Hi again everyone another question again sorry, here’s an error we’re getting on viewing results after voting on a poll:
Notice: Undefined index: pollId in E:\Apache\N00090291\UVote\viewPollResults.php on line 8
Fatal error: Call to a member function getChoice1() on a non-object in E:\Apache\N00090291\UVote\viewPollResults.php on line 50
<?php
require_once 'Result.php';
require_once 'ResultDAO.php';
require_once 'PollDAO.php';
require_once 'Poll.php';
$poll_id = $_GET['pollId'];
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html"/>
<title>Results</title>
<link rel="stylesheet" type="text/css" href="myStyle.css"/>
</head>
<body>
<div id="pageWrap"><!--Start Page Wrap-->
<div id="logo2"><a href="index.php"><img src="images/main_logo.png"/></a></div><!--Logo Here-->
<!--My Account/Sign Out buttons here -->
<div id="account">
<ul>
<li><a href="myAccount.php"><img id="acimg" src="images/account.png"/></a></li>
<li><a href="logout.php"><img id="sigimg" src="images/signOut.png"/></a></li>
</ul>
</div>
<!--My Account/Sign Out buttons here -->
<div id="content">
<div id="navbar">
<ul>
<li><a href="createPollForm.php">Create Poll</a></li>
<li><a href="viewPolls.php" >View Polls</a></li>
<li><a href="friends.php" id="onlink1">Friends</a></li>
</ul>
</div>
<div id="polresult"><!--Poll result div-->
<legend>Polls Results</legend>
<!-- Poll Results List here -->
<?php
$resultDAO = new ResultDAO();
$results = $resultDAO->getPollResults($poll_id);
$Choice1 = $resultDAO->getchoice1($poll_id);
$Choice2 = $resultDAO->getchoice2($poll_id);
$Choice3 = $resultDAO->getchoice3($poll_id);
$Choice4 = $resultDAO->getchoice4($poll_id);
$pollDAO = new PollDAO();
$polls = $pollDAO->getPoll($poll_id);
$choiceName1 = $polls->getChoice1();
$choiceName2 = $polls->getChoice2();
$choiceName3 = $polls->getChoice3();
$choiceName4 = $polls->getChoice4();
$numVotes = count($Choice1) + count($Choice2) + count($Choice3) + count($Choice4);
$percentChoice1 = ($numVotes != 0) ? ((float) $Choice1) / $numVotes : 0;
$percentChoice2 = ($numVotes != 0) ? ((float) $Choice2) / $numVotes : 0;
$percentChoice3 = ($numVotes != 0) ? ((float) $Choice3) / $numVotes : 0;
$percentChoice4 = ($numVotes != 0) ? ((float) $Choice4) / $numVotes : 0;
?>
</ul>
<ul>
<li>
<span class="total-votes"><?php echo count($Choice1); ?>%</span><?php echo $choiceName1; ?>
<br/>
<div class="results-bar" style="width: <?php echo round($percentChoice1, 2); ?>%">
</div>
</li>
<li>
<span class="total-votes"><?php echo count($Choice2); ?>%</span><?php echo $choiceName2; ?>
<br/>
<div class="results-bar" style="width: <?php echo round($percentChoice2, 2); ?>%;">
</div>
</li>
<li>
<span class="total-votes"><?php echo count($Choice3); ?>%</span><?php echo $choiceName3; ?>
<br/>
<div class="results-bar" style="width: <?php echo round($percentChoice3, 2); ?>%;">
</div>
</li>
<li>
<span class="total-votes"><?php echo count($Choice4); ?>%</span><?php echo $choiceName4; ?>
<br/>
<div class="results-bar" style="width: <?php echo round($percentChoice4, 2); ?>%;">
</div>
</li>
</ul>
<h5>Total votes:<?php echo $numVotes; ?></h5>
<a href="viewPolls.php">Back to View Polls</a>
</div><!--Poll result div ends here-->
</div>
</div>
<div id="footer">
<h3>UVote © 2012</h3>
<ul>
<li><a href="about.php">About </a>-</li>
<li><a href="contactForm.php">Contact Us </a></li>
</ul>
</div>
</body>
</html>
<?php ?>
Any suggestions would be greatly welcomed thanks again for the help with the last error…