38 users online (0 members and 38 guests)  


  Results 1 to 1 of 1

Related

  1. Need help with PHP poll code    Forum: PHP Forum
    Replies: 4
  2. Help with PHP poll script    Forum: PHP Forum
    Replies: 10
  3. Replies: 2
  4. php code for poll    Forum: PHP Forum
    Replies: 4
  5. Replies: 1
  1. #1
    Elle0000's Avatar
    New User

    Status
    Offline
    Join Date
    Oct 2006
    Posts
    3

    Hand Writing Poll Results Scripts

    I need to display the results of a short poll, and display the percentage of results for each option in each question.
    I don't know how to calculate the total number of results for each option or how to calculate and display the percentage of each vote.
    One of the questions asks for your favorite month. I used M1-M12 to represent the checked value for the months. Below is what I have for the results script so far.
    Thanx muchly
    PHP Code:
    <html> 
    <head> 
    <title>Your Favorites</title> 
    <style type="text/css"> 
    <!-- 
    .style1 { 
    color: #333399; 
    font: bold 24px Arial; 
    text-align: center; 

    .style2 { 
    color: #333399; 
    font: bold 14px Arial; 

    .style5 { 
    font-size: 16px; 
    color: #330099; 
    font-family: Arial; 

    (resizable=yes,width=450,height=620) 

    --> 
    </style> 
    </head> 
    <body> 
    <form action="Poll.html" method="get"> 
    <p class="style1">Your Favorites !</p> 
    <strong> 
    <p class="style5"> Thank you participating in this poll. <br> 
    If any items are incomplete, please hit the back button and complete your submission. </p> </strong> 
    <br> 
    <?php 
    if ( $Flower == "" ) { 
    $error=true
    echo 
    "Please vote for your favorite flower."
    } else { 
    echo 
    "Your favorite flower is the: $Flower."; } 
    ?> 
    <br><br> 
    <?php 
    if ( $Month == "" ) { 
    $error=true;Vote for your favorite month."; 
    } else { 
    echo "
    Your favorite month is$Month."; } 
    ?> 
    <br><br> 
    <?php 
    if ( 
    $Sport== "" ) { 
    $error=true; 
    echo "
    Please vote for your favorite sport."; 
    } else { 
    echo "
    Your favorite sport is$Sport."; } 
    ?> 
    Below are the results for each Month option: 
     
    <?php 
    $Jantotal=0 
    While (
    $Month=M1) } 
    $Jantotal=sum($M1); } 
    $JanPercent=($Jantotal/(sum($M1));} 
     
    echo 
    $JanPercent of people voted for January 
    January received 
    $Jantotal votes 

    ?> 
    <br> 
    <input type="
    Submit" value="BACK" name="Submit"> 
    <br> 
    <p class="
    style5"> <strong>Thanks for your time.</strong> </p> 
    </form> 
    </body> 
    </html>
    Last edited by HTML; 10-10-2006 at 04:26 PM.



Tags for this Thread