Jump to content

PHP, Ajax, MySQL poll


colombian

Recommended Posts

I was looking around online to see examples of polls that combine these 3 techniques. But I didn't find anything that really worked well.

 

Any suggestion on some? Or code help to get it rolling.

 

I can do it in PHP/MySQL fine, but I want to add Ajax, and I am having trouble making the submit part of the form activate the ajax needed to refresh it.

 

<form action="PHP/JavaScriptPathCode" method="post">
				<?  while( $row = mysql_fetch_array($query) ) //Begin a loop to echo out each option
				  { ?>
					 <label><input type="radio" name="web_poll" value="<?= $row['option'] ?>" /> <?= $row['option'] ?></label><br />
				  <? } 
				  echo '<input name="" type="submit" /></form>';

 

The table consists of 3 pieces of data.

ID, option, and counter

 

I would like it that when the user submits the form, it will update the counter of the particular selection in the database, as well as refreshing that small area to display the results.

 

Any help or pointers would be greatly appreciated.

 

thanks.

 

Link to comment
https://forums.phpfreaks.com/topic/60673-php-ajax-mysql-poll/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.