Jump to content

Recommended Posts

Hi, I have set up a number of pages with a vote poll on them, I need the page to refresh when the submit button is pressed, the php code is:

 

I have tried doing it without the window.location.reload() but it makes not difference

 

echo '<td width="330" valign="top">

<div class="vpolls" id="vp_1">

<div class="vpdt"></div>

<span class="h5">Do you agree with this new system of collecting Council Tax?

</span>

<form action="http://www.tckennedy.co.uk/vpoll/vpoll.php" id="vpf1" method="post"

onsubmit="return votePoll(this);window.location.reload();">

<input type="hidden" name="idp" value="1" />

<label for="p1i0"><input type="radio" name="item" value="Yes" id="p1i0" />Yes</label>

<label for="p1i1"><input type="radio" name="item" value="No" id="p1i1" />No</label>

<label for="p1i2"><input type="radio" name="item" value="Undecided" id="p1i2" />

Undecided</label>

<input type="submit" value="Vote" name="sbm" />

<br> <p><span class="p5">Please note that only one vote per person is now permitted for each poll</span></p>

</form>

</div></td>'
;

echo
'<td width="10"><p>  </p></td>';

echo
'<td width="330" valign="top">';

include(
'vpoll/vpoll.php');

echo
'<div class="vpolls">'. $obVot->showPoll(1) .'</div>';

echo
'</td>';

echo
'<td width="290"></td>';

echo
'</tr>';

echo
'</table>';

?>

 

The website is tckennedy.co.uk where you can see what is happening. I need the page to refresh when the vote button is pressed and the results to update. Any help with this would be really gratefully recieved. Thanks
 

Link to comment
https://forums.phpfreaks.com/topic/279681-php-vote-poll-not-displaying-data/
Share on other sites

If you are talking about one of the many pages you have set up I'm guessing you are presenting the user with a blank poll page, he answers your questions and submits it, you process his votes, add them to your database and want to return a page showing the total vote counts for the topics on that page. Yes?

 

So in the part where you display the questions and the vote input tags do this:

 

On the first pass (voting pass) show the question and input tags but don't show the fields interspersed among the questions that will show the vote totals.

 

On the second pass (after doing a db update and a query to get the new totals) show the questions again and this time also output the voting results after each question.

 

No?

Edited by ginerjm
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.