Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7663459
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T14:03:54+00:00 2026-05-31T14:03:54+00:00

I am this is for a polling system I am making, this code shows

  • 0

I am this is for a polling system I am making, this code shows the user a list of questions they can pick from:

        <div class="main_questions">
            <p class="style1 style2"><strong>Select Your Question</strong></p>

<p class="style1">
            <form action="vote_list.php" method="post" name="form1" class="style1">
            <?php
                        $sql = "SELECT DISTINCT (question_tba) FROM question ORDER BY answer_id DESC";
                        $result = mysql_query($sql);
                        while($row = mysql_fetch_array($result)){
                            ?>
                            <p>
                                <?php echo $row['question_tba']; ?>
                                <input type="radio" name="questions" value="<?php echo $row['question_tba']; ?>">

                            </p>

                            <?php
                        }      
            ?>
            <input type="submit" name="submit" value="Vote">
            </p>
        </div>

This code should then post the chosen question to this page which allows them to cast a vote:

<?php

include('core/initialise.inc.php');

$q = $_POST['question_tba'];

if (isset($_GET['vote'], $_GET['id'])){
    add_vote($_GET['id'], $_GET['vote'], $q);
    echo "<META HTTP-EQUIV=\"REFRESH\" CONTENT=\"0; URL=vote_logged.php\">";
}

?>

</div>
<div class="main_questions">
    <p class="style1 style2"><strong>Place Your Vote!</strong></p><?php
        foreach (get_answers($q) as $id => $answer){
            ?>
            <p>
            <?php echo $answer; ?>
            <a href="?vote=up&amp;id=<?php echo $id; ?>">Vote</a>
        </p>
        <?php
        }

        ?>
</div>

Then when they click on an answer to vote on the functions on this page should increment the chosen answers vote by 1 using these functions:

<?php

function get_answers($q){
    $q = $q;
    $sql = "SELECT answer_id, answer FROM question WHERE question_tba = '$q'";
    $result = mysql_query($sql);

    echo "$result";

    $answers = array();
    while (($row = mysql_fetch_assoc($result)) or die(mysql_error()))
    {                                                                         
        $answers[$row['answer_id']] = $row['answer'];
    }

    return $answers;
}

function add_vote($answer_id, $vote, $q2){
    $q2 = $q2;
    $answer_id = (int)$answer_id;
    $vote = '+';

    $sql = "UPDATE question SET answer_votes = answer_votes $vote 1 WHERE question_tba = $q2 AND answer_id = $answer_id";

    mysql_query($sql);

}

?>

However, my problem is that when I click on the question I would like to vote on, instead of displaying the answers that I can choose to vote from, it just displays Resource id #6. Can anyone tell me what is wrong with my code?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T14:03:55+00:00Added an answer on May 31, 2026 at 2:03 pm

    Okay, got this sorted out. Turns out, when posting a radio button value you have to use the name=”” instead of value=”” pretty easy solution.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I can find lots of information on how Long Polling works (For example, this
System A captures X information from users via UI. This information is validated and
Is this chat using long polling or http streaming ? http://go-mono.com/moonlight/chat.aspx
I want to know if this web app are using long polling or anything
This is related to my previous question , regarding pulling objects from a dmp
I have setup a polling system, where when you vote it stores your external
I have set up a polling system on my website. However to ensure that
I'm writing a top 10 polling system. Pollsters vote weekly on their top 10.
UPDATE: thanks to all the answer given, but they are all about the system
I'm currently in charge of setting up a polling system (using PHP). Now for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.