The _php of PHP and JavaScript in the processing of multiple choices

Source: Internet
Author: User

We often have to make a number of choices for the user to process, such as allowing users to select multiple items of list items after the deletion of the selected items. Here's an example of how PHP and JavaScript deal with multiple choices, respectively. What we do today is a voting system that polls the MySQL database itemtable, and can only vote two votes per individual IP.



The table itemtable is established through the following MySQL statement:

CREATE TABLE ' itemtable ' (
' ID ' TINYINT (4) Not NULL auto_increment,
' Name ' VARCHAR not NULL,
' Votes ' SMALLINT (6) Not NULL,
PRIMARY KEY (' id ')
);

Where the field "name" is the list item name, "votes" is the resulting number of votes. We also want to create a table "voteiptable" to record the IP of the voting user:

CREATE TABLE ' voteiptable ' (
' ID ' SMALLINT (6) Not NULL,
' Voteip ' VARCHAR not NULL,
PRIMARY KEY (' id ')
);

Below we write the file "multivote.php", today we want to use a database class file "dbclass.php".




We can see that the client's JavaScript and server-side PHP have a lot in common with the processing of multiple choices, and of course they are different. This is a more classic multi-option processing program, if you do not qualify the user's choice of words is simpler.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.