FX Do Rate Multiple  (by Felice Di Stefano)
(ASP Js, ASP Vbs, PHP MySQL, PHP ADODB)

The process to do a poll it will be divided in two pages one to vote and one to show the results. This server behavior will add the necessary code to do the rating in a situation when you assign different score to different item candidates using an input like a listmenu (see demo 2).

Preparing the page

You may use any of the tables of your database which is suitable for this task, you will need only to add a column to record the score and name it as you wish, this column must be of the type float, so you can use also score in decimals if required, and a default value of 0. It will be required the creation of a table with a single column Varchar 15 to collect all the IPs to avoid that users may vote more than one time and this will give also the number of voters. Remember that for each poll you must have a dedicated IPs table, just name it as you like.
Create a recordsets to retrieve the item candidate names and the relative unique identifier like an id. At this point insert a form on the page and inside create the table to list the candidates, one row and two columns will be enough, display the candidate on one column and in the other insert a listmenu (you may use other type of element but the listmenu I believe is the most suitable) with an appropriate name. Select the table row and apply the Repeat Region sb of the candidates recordset. Add a submit button outside the loop to complete the form, give a name if DW did not.
Now open the FX Do Rate Multiple sb from the FX Poll and Ratings submenu in the server behaviors palette and apply it.

Applying

Form: Select here the used form.
Connection: Select here the used connection, usually the same one used for the recordsets.
Update Table: Select here the candidates table where the rating will be updated.
Rating Column: Select here the column used for the rating or votes to be recorded and updated.
Where Column: Select here the candidate unique identifier usually an id.
Rating Element: Select here the name of the element used to give a score.
IP Table: Select here the table used to record the user's IP.
IP Column: Select here the name of the column where IPs are recorded. Since there will be only one column it will be already selected.
Submit Button Name: Select here the name of the button used to submit the form.
Display Recordset: Select here the recordset used to display the item candidates.
Cookie Name: Define the name of a cookie to save the user ip.
Valid Days: Define the number of days the cookie will last. You may want to use a longer time in case you are not sure how long the poll will last. Remember that you cannot exceed the year 2035 otherwise it will work like a date in the past.
Close Poll: This checkbox is used in case you want to close the poll and show only the results. Note that the state of this box must be always the same in both pages, poll and results, otherwise you may risk to achieve an infinite ping pong of the pages.
Redirect To: Define here the redirection page which will be obviously the results page.

It would be a good thing to add a Do Not Cache code in this page. You may find one for PHP here and some for ASP at the Adobe Exchange.

After this create the results page using the object FX Display Rating or FX Display Average Rating.

by FELIXONE