php voting poll form - need to make the page refresh showing new results data

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:
[php]

echo ’

 <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" /> 


Please note that only one vote per person is now permitted for each poll

 </form>

 </div></td>';

echo ’

  

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

    include('vpoll/vpoll.php');

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

 echo '</td>';

echo ‘

’;
 echo '</tr>';

 echo '</table>';

[/php]

the website is tckennedy.co.uk where you can see what is happening. Any help with this would be really gratefully recieved. Thanks

I tried your poll, was’nt submitting at all. You using MySql or txt file for storing data?

Any way maybe this is the answer you are looking for.

When you are ready to actually submit the form to the server you can do it in Javascript like this.

document.getElementById(“button1”).submit();

Maybe this will help also

http://w3schools.com/ajax/ajax_xmlhttprequest_send.asp

Sponsor our Newsletter | Privacy Policy | Terms of Service