Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 7 of 7
  1. #1
    Junior Member
    Join Date
    Dec 2012
    Posts
    29
    Member #
    34228
    For this Php MySQL poll, I have connected this to my server already and got the poll as-written, to work, but I want checkboxes instead, not radioboxes where only one option can be voted on. The idea is to have visitors vote on 90-100 ice-skating tricks and choose all the tricks that they like the most, and show those results in (results.php), which would be a php include on the 'Top Tricks' page.

  2.  

  3. #2
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,716
    Member #
    5580
    Liked
    718 times
    So there will be a list of 90-100 tricks? How will someone possibly remember which of those they liked? I can't even remember what I ate for dinner last night.


  4. #3
    Junior Member
    Join Date
    Dec 2012
    Posts
    29
    Member #
    34228
    Quote Originally Posted by mlseim, post: 251089, member: 5585
    So there will be a list of 90-100 tricks? How will someone possibly remember which of those they liked? I can't even remember what I ate for dinner last night.
    It's like knowing a favorite dance move out of many.

  5. #4
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,716
    Member #
    5580
    Liked
    718 times
    Do you have that simple database of photos ... if i remember, you created a simple text file and php to display photos? Would that list be similar to the checkboxes that would be listed?

    It would be easy to let php generate your checkbox list and process the user's choices. In fact, it can also use cookies to remember their choices for any given pc.


  6. #5
    Junior Member
    Join Date
    Dec 2012
    Posts
    29
    Member #
    34228
    Quote Originally Posted by mlseim, post: 251094, member: 5585
    Do you have that simple database of photos ... if i remember, you created a simple text file and php to display photos? Would that list be similar to the checkboxes that would be listed?

    It would be easy to let php generate your checkbox list and process the user's choices. In fact, it can also use cookies to remember their choices for any given pc.
    It's similar but not the same. I mean... it wouldn't be that hard for me to type out all of the names of the tricks and put them into alphabetical order, and insert them into the <fieldset> for the HTML as checkboxes. The problem is that the Php script doesn't handle multiple values because the script was designed for radio buttons.

    Code:
    <fieldset>
        <legend>What is your JavaScript library of choice?</legend>
        <form action="<?php echo $editFormAction; ?>" id="form1" name="form1" method="POST">
            <label>
                <input type="radio" name="Poll" value="mootools" id="Poll_0" />
                Mootools
            </label>
            <label>
                <input type="radio" name="Poll" value="prototype" id="Poll_1" />
                Prototype
            </label>
            <label>
                <input type="radio" name="Poll" value="jquery" id="Poll_2" />
                jQuery
            </label>
            <label>
                <input type="radio" name="Poll" value="spry" id="Poll_3" />
                Spry
            </label>
            <label>
                <input type="radio" name="Poll" value="other" id="Poll_4" />
                Other
            </label>
            <input type="submit" name="submit" id="submit" value="Vote" />
            <input type="hidden" name="id" value="form1" />
            <input type="hidden" name="MM_insert" value="form1" />
        </form>
    </fieldset>
    And right I'm confused because I don't even know how to display 99 tricks (which is the exact number) and have it NOT look like one big pile of a mess. I don't know how to make the html look good, aside from not knowing the coding to make the php script function with checkboxes.

  7. #6
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,716
    Member #
    5580
    Liked
    718 times
    Your form will use a checkbox array ....

    Example:
    <input type="checkbox" name="trick[]" value="1"> Trick 1 <br />
    <input type="checkbox" name="trick[]" value="2"> Trick 2 <br />
    <input type="checkbox" name="trick[]" value="3"> Trick 3 <br />

    As far as the PHP goes, you're going to have to create your own PHP script, not use the one you have. Can you describe how the voting goes? Can anyone vote? Do they need to log-in to vote? What happens if someone votes 10 times?

    You will have a database table with the 100 tricks in it. Each time the checkbox array is processed for votes, the database table will be updated ... adding votes to each one.

    Having that database will allow PHP to use that for dynamically creating the HTML form.

    When you installed the existing voting script, did you create a MySQL database for that?


  8. #7
    Junior Member
    Join Date
    Dec 2012
    Posts
    29
    Member #
    34228
    Well, right now, I managed to find someone in my own personal network to write a script for me - - obviously it's being done for free, but I would like to have a limitation to how many times people can vote. And I don't want a log-in requirement for people to vote. The existing script required MySQL setup for the database but the database script to setup the tables was already provided in the tutorial. The polling results was dynamically created with percentages as well as the new script that my PhP person is writing.

    Perhaps you can look at the poll after it's been written and integrated into my website? I would certainly like to know what your perspective is.


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Search tags for this page

code for voting using checkbox in php

,

dynamically creating checkbox php form

,

how to make a polling with checkbox in php

,

php y mysql poll checkbox insert

Click on a term to search for related topics.
All times are GMT -6. The time now is 10:20 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com