in reply to Partial reloads of a page \ script ?
Something like that. In index.shtml you'd include vote.cgi?action=show. Your poll html should include the hidden field <input type="hidden" name="action" value="vote">.# ... $action = $query->param('action'); $voted = hasuservoted(); if ($action eq "show") $voted ? show_results() : show_poll(); } elsif ($action eq "vote" && !$voted) { vote(); } else { error("no valid action"); } sub show_poll { # display the poll so the user can fill it in. } sub show_results { # show the poll results -- user can no longer vote } sub vote { # record the user's vote # record who voted # redirect to index.shtml } sub hasuservoted { # returns 1 if user has voted # returns 0 if user has no voted }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Partial reloads of a page \ script ?
by lagrenouille (Acolyte) on Aug 28, 2002 at 11:59 UTC |