TK55 Posted June 29, 2013 Share Posted June 29, 2013 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 Quote Link to comment Share on other sites More sharing options...
ginerjm Posted June 29, 2013 Share Posted June 29, 2013 (edited) 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 June 29, 2013 by ginerjm Quote Link to comment Share on other sites More sharing options...
chriscloyd Posted June 30, 2013 Share Posted June 30, 2013 why not just have javascript get the totals and place them so you don't have to refresh - Me personally I hate having a page refresh Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.