If you are not registered or logged in, you may still use these forums but with limited features. Show recent topics
  [Search] Search   [Hottest Topics] Hottest Topics   [Members]  Member Listing   [FAQ]  FAQ 
[Register] Register / 
[Login] Login 
How to display several polls, one after the other ?  XML
Forum Index » Support Forum
Author Message
mercadoalex
Newbie

Joined: 14/04/2007 00:04:37
Messages: 4
Offline

I want to display several polls one after the other, how can I achieve it?

I have about 15 polls and I want the user to answer one by one,
showing the results at the end of the whole process I mean until the
user has completed the 15 polls.

Is that possible?
Any help will be great?
regards, Alex
mercadoalex
Newbie

Joined: 14/04/2007 00:04:37
Messages: 4
Offline

Code:
if ($action=="results" && $poll_id==$poll_ident) {
return $this->view_poll_result($poll_id,0);
} elseif (!$is_active) {
return $this->view_poll_result($poll_id,0);
} elseif ($is_active && $voted) {
return $this->view_poll_result($poll_id,1);
} elseif (!$voted && isset($option_id) && $action=="vote" && $poll_id==$poll_ident) {
$this->update_poll($poll_id,$option_id);
return $this->view_poll_result($poll_id,0);
} else {
return $this->display_poll($poll_id);
}

thats the part of the code in class_poll.php that tells it what to do once you have voted. Well part of it does. The line that tells it to show the results after posting is
Code:
return $this->view_poll_result($poll_id,1);

So instead of view the poll results, I want to display another poll,
return $this->display_poll($poll_id);
where $poll_id must indicate the following poll, so I tried this
return $this->display_poll($poll_id + 1);
but It doesn´t work correctly
mercadoalex
Newbie

Joined: 14/04/2007 00:04:37
Messages: 4
Offline

I found that this guy posted a pretty similar question.
This is the thread
one poll to the next poll without showing results?
http://proxy2.de/forum/viewtopic.php?t=5193

but stilll unanswered...
maurice
Newbie

Joined: 17/06/2007 14:42:55
Messages: 1
Offline

I did experience the same problem.

So I did write some code to create a survey of several polls and in the end display the results.
Save this as a file (for example survey.php) in the root path of the poll scripts.
Change the paths in the file for the include_once to your own paths.


<?php
// Important! You have to include it before your html code
include_once "/poll/poll_cookie.php";
?>

<html>
<body>
<?php
include_once "/poll/booth.php";

// Determine the poll ID's to use in this survey
$poll_start_id=4; //The first poll ID to start
$poll_end_id=9; //The last poll ID to include


// Set Variables for the poll class
$php_poll->set_template_set("plain");
$php_poll->set_max_bar_length(125);
$php_poll->set_max_bar_height(10);


// Determine if the form is allready posted and determine the poll ID
if (!isset($_POST['poll_ident'])) {
// Not posted yet so start with the first ID
$poll=$poll_start_id;
}
else {
// Posted, so process the poll and add 1 to the poll ID
$php_poll->poll_process($_POST['poll_ident']);
$poll=$_POST['poll_ident']+1;
}

// Determine if a new poll has to be shown
if ($poll<=$poll_end_id) {
// While the last ID is not reached yet show the next poll
echo "Variabele: ".$_POST['poll_ident'];
echo $php_poll->poll_process($poll);
}
elseif ($poll==$poll_comment_id) {

}
else {
// If the last poll is reached then show the results
for ( $counter = $poll_start_id; $counter <= $poll_end_id; $counter += 1) {
echo $php_poll->view_poll_result($counter);
}
}



?>
</body>
</html>
 
Forum Index » Support Forum
Go to:   
Based on the open source JForum