Polling in php, ajax, mysql

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Limno
    New Member
    • Apr 2008
    • 92

    Polling in php, ajax, mysql

    Hi all,

    Can anyone send me a link/code for online polling in php. I am looking for good and graphical polling for my web-page.

    Thanks in Advances..
  • Atli
    Recognized Expert Expert
    • Nov 2006
    • 5062

    #2
    Hey.

    Did you try a Google search? There are a lot of scripts like these out there.
    This one looks promising.

    Comment

    • Limno
      New Member
      • Apr 2008
      • 92

      #3
      Hi Atli,
      Thanks for replying,
      I tried many, but not getting any good one, can u send me that downloaded file, i cant access download here. or please send me that code,
      its urgent.
      Thanks

      Comment

      • Atli
        Recognized Expert Expert
        • Nov 2006
        • 5062

        #4
        I don't really have any files or scripts to send you. There are a lot of them available online, though, so you can just use Google and take your pick.

        If none of them are working for you, you might need to create your own, or modify one of the existing once. I'm not going to do it for you, but if you run into problems doing it yourself, I am more than willing to try to help you solve them. Just post them here.

        Comment

        • Limno
          New Member
          • Apr 2008
          • 92

          #5
          Thanks for replying,

          i m using ajax code for my polling system.
          Code:
          <input type="radio" name="vote"  value="<?php echo $row['choice'];?>" size="1" onclick="showUser(this.value,'<?php echo $row_['id'];?>')"/>
          Ajax code of some lines:
          Code:
          var url="poll.php";
          url=url+"?q="+str;
          url=url+"&q1="+value;
          xmlhttp.onreadystatechange=stateChanged;

          But i need to call my ajax function, on onclick submit button ie.

          Code:
          <input type="submit" name="submit" value="vote" />
          can u tell me how to code here on submit input type.

          Thanks again.
          Last edited by Atli; Dec 17 '09, 09:59 AM. Reason: Added code tags.

          Comment

          • Atli
            Recognized Expert Expert
            • Nov 2006
            • 5062

            #6
            You should rather use the form's onsubmit event, rather than the submit buttons onclick event. That way you can stop the form from being submitted the old fashion way.

            In your HTML, you could do something like:
            [code=html]<form onsubmit="retur n onsubmit_callba ck();">[/code]
            Which might call a function like this:
            [code=javascript]function onsubmit_callba ck(e) {
            // Do your AJAX call here
            var url = 'formUpdateScri pt.php';
            var data = $('form').eq(0) .serializeArray ( );

            $.post(url, data, function(data, message)() {
            if(message == 'success') {
            alert('Success! Request returned: ' + data);
            }
            else {
            alert('Update failed! (' + message +')');
            }
            }, 'text');

            // Return FALSE when you are done.
            // This prevents the form from being submitted
            // the old fashion way.
            // DO NOT FORGET THIS OR THIS WON'T WORK!
            return false;
            }[/code]
            Note that I use jQuery for the AJAX example. It's so much simpler than the native JavaScript syntax.

            Pay special attention to the return value of the function. If it is not set to false, the form will be submitted as usual and you will not see the result of the AJAX query.

            Comment

            • Limno
              New Member
              • Apr 2008
              • 92

              #7
              Thanks you soo much, Its really help for me. Now i got some idea, i hope it will work.

              Comment

              Working...