|
[x]
Posted via EE Mobile
|
|
| Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again. |
|
|
|
|
Asked by mattibutt in PHP and Databases, Web Development, Jquery
hi i have poll form which is posted like traditional way problem is the poll is at bottom of the page when user post the page instead of showing the poll the page is reloaded from the top and it doesnt show the poll i want to apply the ajax rule so when user post the poll the page shouldn't refresh and the post back can display the result while user at the bottom of the page
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
|
function print_vote_form($poll_id)
{
global $tapps_dir, $tapps_email_confirmation;
$result = mysql_query("SELECT * FROM tapps_polls WHERE poll_id=$poll_id");
$poll = mysql_fetch_object($result);
if ($poll)
{
echo " $poll->description<br>\n";
$result = mysql_query("SELECT option_id,option_text,counter FROM tapps_votes WHERE poll_id=$poll_id ORDER BY option_id");
?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<?
echo "<input type=\"hidden\" name=\"mode\" value=\"vote\">\n";
echo "<input type=\"hidden\" name=\"poll_id\" value=\"$poll->poll_id\">\n";
$num_votes=0;
if ($poll->max_answers > 1)
{
echo "($poll->max_answers options.)<br>\n";
echo "<table cellpadding=0 cellspacing=2>\n";
while ($row = mysql_fetch_object($result))
{
"<tr><td align=\"right\">\n";
"<input type=checkbox name=\"options[]\" value=\"$row->option_id\" id=\"o$poll->poll_id-$row->option_id\">\n";
"</td><td align=\"left\">\n";
"<label for=\"o$poll->poll_id-$row->option_id\">$row->option_text</label><br>\n";
"</td></tr>\n";
$num_votes=$num_votes+$row->counter;
}
echo "</table>\n";
} else
if ($poll->max_answers > 0)
{
echo "<table><tr><td>\n";
while ($row = mysql_fetch_object($result))
{
echo "<input type=radio name=\"options[]\" value=\"$row->option_id\" id=\"o$poll->poll_id-$row->option_id\ class=\"inputbuttons\">\n";
echo "<label for=\"o$poll->poll_id-$row->option_id\">$row->option_text <br></label>";
$num_votes=$num_votes+$row->counter;
}
echo "</td></tr></table>\n";
}
echo "<br>\n";
if (isset($tapps_email_confirmation) && $tapps_email_confirmation==TRUE)
{
echo "Email: <input type=\"text\" name=\"voter_email\" value=\"\"><br>\n";
}
|
20091111-EE-VQP-89 - Hierarchy / EE_QW_3_20080625