Form can only be submitted once?
-
Howdy!
I′ve made a plugin where a loop returns some objects to a page or post, user can put it anywhere with a shortcode.
It is possible to vote on each of these objects, I′ve put a little form in with a submit button and a value. This is the <form>-part of the loop:
$poll_sel_output .= "<form action=\""; $poll_sel_output .= str_replace( '%7E', '~', $_SERVER['REQUEST_URI']); $poll_sel_output .= "\" method=\"post\">"; $poll_sel_output .= "<input type=\"hidden\" name=\"object_id\" value=\""; $poll_sel_output .= $poll_sel_item->id; $poll_sel_output .= "\">"; $poll_sel_output .="<input type=\"submit\" name=\"vote_this\" value=\"+\">"; $poll_sel_output .= "</form>";
In the same file, the main plugin file for what it′s worth, the update is done:
$current_object_id = $_POST['object_id']; $table_name = $wpdb->prefix . "vote_objects"; $wpdb->update( $table_name, array( value => value+1 ), array('id' => $current_object_id ), array( '%d' ), array('%d') );
The vote system actually works, the correct value gets updated, however, you can only vote for one object once. Is this because I already voted from my computer/IP or is there another reason?
Thanks.
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Form can only be submitted once?’ is closed to new replies.