PHP and JavaScript processing of Multiple Choices

Source: Internet
Author: User
PHP and JavaScript are used to process multiple choices. When reading how PHP and JavaScript process multiple choices, we often need to make multiple choices for users, for example, you can select multiple items in the list and then delete the selected items. Today, we will give an example to illustrate how PHP and JavaScript process multiple choices. Today we are working on a voting system, for MyS "> <LINKhref =" htt

We often need to make multiple choices for users, such as allowing users to select multiple items in the list and delete the selected items. Today, we will give an example to illustrate how PHP and JavaScript process multiple choices. Today, we are working on a voting system to vote for items in the itemtable table of the MySQL database, and each individual IP Address can only vote for two votes.


 
The itemtable is created using the following MySQL statement:

Create table 'itemtable '(
'Id' TINYINT (4) not null AUTO_INCREMENT,
'Name' VARCHAR (50) not null,
'Votes 'SMALLINT (6) not null,
Primary key ('id ')
);

The field "name" is the name of the list project, and "votes" is the number of votes. We also need to create a table "voteiptable" to record the IP address of the voting User:

Create table 'voteiptable '(
'Id' SMALLINT (6) not null,
'Voteip' VARCHAR (15) not null,
Primary key ('id ')
);

Next we will write the file "multivote. php". Today we will use a database file "dbclass. php ".




We can find that the JavaScript on the client and PHP on the server have many similarities and differences in processing multiple choices. This is a classic multi-option processing program, which is simpler if user options are not limited.

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.