473,382 Members | 1,078 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Polling in php, ajax, mysql

92
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..
Dec 15 '09 #1
6 2975
Atli
5,058 Expert 4TB
Hey.

Did you try a Google search? There are a lot of scripts like these out there.
This one looks promising.
Dec 15 '09 #2
Limno
92
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
Dec 15 '09 #3
Atli
5,058 Expert 4TB
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.
Dec 16 '09 #4
Limno
92
Thanks for replying,

i m using ajax code for my polling system.
Expand|Select|Wrap|Line Numbers
  1. <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:
Expand|Select|Wrap|Line Numbers
  1. var url="poll.php";
  2. url=url+"?q="+str;
  3. url=url+"&q1="+value;
  4. xmlhttp.onreadystatechange=stateChanged;

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

Expand|Select|Wrap|Line Numbers
  1. <input type="submit" name="submit" value="vote" />
can u tell me how to code here on submit input type.

Thanks again.
Dec 17 '09 #5
Atli
5,058 Expert 4TB
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:
Expand|Select|Wrap|Line Numbers
  1. <form onsubmit="return onsubmit_callback();">
Which might call a function like this:
Expand|Select|Wrap|Line Numbers
  1. function onsubmit_callback(e) {
  2.     // Do your AJAX call here
  3.     var url = 'formUpdateScript.php';
  4.     var data = $('form').eq(0).serializeArray( );
  5.  
  6.     $.post(url, data, function(data, message)() {
  7.         if(message == 'success') {
  8.             alert('Success! Request returned: ' + data);
  9.         }
  10.         else {
  11.             alert('Update failed! (' + message +')');
  12.         }
  13.     }, 'text');
  14.  
  15.     // Return FALSE when you are done.
  16.     // This prevents the form from being submitted
  17.     // the old fashion way.
  18.     // DO NOT FORGET THIS OR THIS WON'T WORK!
  19.     return false;
  20. }
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.
Dec 17 '09 #6
Limno
92
Thanks you soo much, Its really help for me. Now i got some idea, i hope it will work.
Dec 18 '09 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Dennis Ålund | last post by:
Is it possible to notice a change of window.location.hash without polling? I'm working on a Ajax-platform (yes, inventing the wheel again) and have finished almost everything except the support...
2
by: alacrite | last post by:
I am doing some form validation with a mix of javascript and server side methods called via AJAX. When the submit button is pressed the onclick calls the validation function that will return true...
3
by: petermichaux | last post by:
Hi, I am trying to put together the last major pieces of my project's puzzle. This is more website/client-side architecture than JavaScript syntax but I hope this is a good place to ask. I'm a...
1
by: kelvin.jones | last post by:
Hi guys, I have read several discussions on this group (and others) that talk about polling a server using ajax transactions and if it is possible to push to the client. The general consensus seems...
7
by: Ivan Marsh | last post by:
Hey Folks, I'm having a heck of a time wrapping mind around AJAX. Anyone know of a simple, straight-forward example for pulling a simple query from mysql with PHP using AJAX? As I...
5
by: Mike | last post by:
Hi everyone, I would like to be able to send updates to my web page from the server. If I understood correctly, this is not possible to achieve in a web environment, unless some sort of polling...
1
kudos
by: kudos | last post by:
Hi! Im kind of new to ajax (but actually an old timer when it comes to javascript). I have the following question. I have a webapplication that will be accessed from an ajax interface. However, I...
1
by: bcochofel | last post by:
Hi, I'm using Perl CGI and HTML::Template to generate the following XML: ---------------------------------------------------------------------- <?xml version="1.0" encoding="iso-8859-1"?>...
3
by: jarremw | last post by:
hello all, what i have is a modal popup control extender, i have an ajax script that saves the value of the two textboxes that are in the popup, what i am needing is a way to insert those values into...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.