[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.

Question
[x]
Attachment Details

posting a php form as a ajax

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";
		}
[+][-]11/06/09 03:58 AM, ID: 25758343Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/06/09 03:59 AM, ID: 25758348Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/06/09 04:00 AM, ID: 25758352Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/06/09 08:15 AM, ID: 25760423Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/06/09 08:51 AM, ID: 25760782Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/06/09 08:55 AM, ID: 25760824Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/06/09 09:03 AM, ID: 25760910Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/09/09 04:13 AM, ID: 25775146Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/09/09 07:18 AM, ID: 25776592Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/09/09 08:36 AM, ID: 25777446Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/09/09 08:42 AM, ID: 25777520Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/09/09 04:57 PM, ID: 25781604Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/10/09 02:20 AM, ID: 25783959Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/10/09 05:16 AM, ID: 25784987Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/10/09 06:03 AM, ID: 25785393Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/14/09 02:35 AM, ID: 25820122Administrative Comment

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 30-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]11/14/09 02:35 AM, ID: 25820124Administrative Comment

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 30-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]11/14/09 07:46 PM, ID: 25823559Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/15/09 07:10 AM, ID: 25825098Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-89 - Hierarchy / EE_QW_3_20080625