[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
www.dhtmlgoodies.com • View topic - ajax poll
Page 1 of 1

ajax poll

PostPosted: Mon May 08, 2006 7:35 am
by teena
hi !

i m having problems with ajax poller. I m modifying your ajax poller code and using it in my site.
But the moment i click on vote it does not display any result!

in ajax-poller.js file

castMyVote(pollId,formObj) function ,when i try to display pollid ,it displays but when i do

var elements = formObj.elements['vote[' + pollId + ']'];
var len=elements.length;
alert(len)

it does not display the length.

bcoz of which i think its not executing this function .

my database is:

Table structure for table `poll`

CREATE TABLE `poll` (
`poll_id` int(5) NOT NULL default '0',
`poll_quest` varchar(200) collate latin1_general_ci NOT NULL default '',
`poll_type` varchar(10) collate latin1_general_ci NOT NULL default '',
`poll_valid` varchar(20) collate latin1_general_ci NOT NULL default '',
PRIMARY KEY (`poll_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;


Table structure for table `poll_option`

CREATE TABLE `poll_option` (
`poll_id` int(5) NOT NULL default '0',
`option_id` int(5) NOT NULL default '0',
`option` varchar(100) collate latin1_general_ci NOT NULL default '',
`option_weight` int(5) NOT NULL default '0',
PRIMARY KEY (`poll_id`,`option_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;


Table structure for table `poll_vote`

CREATE TABLE `poll_vote` (
`vote_id` int(5) NOT NULL auto_increment,
`poll_id` int(5) NOT NULL default '0',
`option_id` int(5) NOT NULL default '0',
PRIMARY KEY (`vote_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=1 ;

the changes in ajax-poller.php is


<?
// Retreving poll from database
$res = mysql_query("select * from poll where poll_id='1'");
if($inf = mysql_fetch_array($res)){
echo "<p class=\"pollerTitle\">".$inf["poll_quest"]."</p>"; // Output poller title

$resOptions = mysql_query("select * from poll_option where poll_id='1'") or die(mysql_error()); // Find poll options, i.e. radio buttons
while($infOptions = mysql_fetch_array($resOptions)){
if($infOptions["defaultChecked"])$checked=" checked"; else $checked = "";
echo "<p class=\"pollerOption\"><input$checked type=\"radio\" value=\"".$infOptions["option_id"]."\" name=\"vote[".$inf["poll_id"]."]\" id=\"pollerOption".$infOptions["option_id"]."\"><label for=\"pollerOption".$infOptions["option_id"]."\" id=\"optionLabel".$infOptions["option_id"]."\">".$infOptions["option"]."</label></p>";

}
}
?>

rest all of the files are not modified.

plz help me!!

Thanks in advance!

PostPosted: Mon May 08, 2006 11:08 am
by Batalf

PostPosted: Fri May 12, 2006 12:42 pm
by teena

PostPosted: Wed Feb 06, 2008 12:02 am
by spaceman