41 users online (1 members and 40 guests)  


  Results 1 to 5 of 5

Related

  1. I can't figure this out...    Forum: Website Scripts Forum
    Replies: 5
  2. Replies: 1
  3. Replies: 4
  4. Replies: 2
  5. Ie5 and Ie6 ... 100% with doesnt work!    Forum: HTML Forum
    Replies: 6
  1. #1
    Illustrion's Avatar
    New User

    Status
    Offline
    Join Date
    Nov 2003
    Posts
    5

    Cant figure out why my poll doesnt work? ^_^

    Hey all. I just started working with PHP not too long ago...and im building a site. The problem im having is that the poll does work...but nothing is sent to the database, and when thats over with, the poll actually disappears. What i want it to do is have the percentage of the votes for yes and no...can you help out with this? Ill leave the file dealing with the poll here. Any help would be great.
    Attached Files Attached Files

  2. #2
    MD Hall's Avatar
    New User

    Status
    Offline
    Join Date
    Nov 2003
    Posts
    10
    Quote Originally Posted by Illustrion
    Hey all. I just started working with PHP not too long ago...and im building a site. The problem im having is that the poll does work...but nothing is sent to the database, and when thats over with, the poll actually disappears. What i want it to do is have the percentage of the votes for yes and no...can you help out with this? Ill leave the file dealing with the poll here. Any help would be great.
    Double check your db connection. Username, password, db name. Make sure that the db/table for your poll has permissions set for your username/password to access it.

  3. #3
    Illustrion's Avatar
    New User

    Status
    Offline
    Join Date
    Nov 2003
    Posts
    5
    Well...that isnt the problem. It would have given me an error, so i know its not it. I test it out, but when i get into phpMyAdmin to check if the vote registered. it has 1 registry and both fields "yes" and "no" have 0 for an entry. The query i used was this below...which i got the dump out of phpMyAdmin.

    CREATE TABLE poll_results (
    yes tinyint(4) DEFAULT '0' NOT NULL,
    no tinyint(4) DEFAULT '0',
    PRIMARY KEY (yes),
    UNIQUE no (no)
    );

    I know i should have posted this earlier...but yeah...i didnt, so here it is.

  4. #4
    MD Hall's Avatar
    New User

    Status
    Offline
    Join Date
    Nov 2003
    Posts
    10
    If your global variables are off, you may need to use $_POST for your insert query to actually recieve the values from the form input.

    Example...

    <?
    $yes=$_POST['yes'];
    $no=$_POST['no'];

    Try this right after the opening tag of your php input script.

    (I didn't look at the attached file you included, seems its a file my XP doesn't recognize)

  5. #5
    Illustrion's Avatar
    New User

    Status
    Offline
    Join Date
    Nov 2003
    Posts
    5
    Oh, i just used it as an include...you can open it in any text program. I wrote that one in coffeecup html editor.



Tags for this Thread