This article introduces the content of the personal PHP MySQL database encountered some problems, has a certain reference value, now share to everyone, the need for friends can refer to
1, about a page two form submit data to a database
You only need to set the Submit data button to a different class attribute or id attribute, to commit separately, to write JS; it doesn't affect the submission of the data.
2, check box information input MySQL database
Set the same class attribute for all input boxes, and then when the AJAX data is requested, enter the following code
<p class= "checkbox_p" > <input class= "checkbox subject" type= "checkbox" Name= "Subject" value= "All-family"/> <sp An class= "Checkbox_span" > General </span> <input class= "checkbox subject" type= "checkbox" Name= "Subject" value= " Language "/> <span class=" Checkbox_span "> Language </span> <input class=" checkbox subject "type=" checkbox "Name=" s Ubject "value=" math "/> <span class=" Checkbox_span "> Math </span> <input class=" checkbox subject "type=" ch Eckbox "name=" subject "value=" English "/> <span class=" Checkbox_span "> English </span></p><p class=" Checkbox_p "> <input class=" checkbox subject "type=" checkbox "Name=" Subject "value=" physical "/> <span class=" c Heckbox_span "> Physics </span> <input class=" checkbox subject "type=" checkbox "Name=" Subject "value=" Chemical "/> <span class= "Checkbox_span" > Chemistry </span> <input class= "checkbox subject" type= "checkbox" Name= "Subject" value= "Creature"/> <span class= "cHeckbox_span "> Biology </span> <input class=" checkbox subject "type=" checkbox "Name=" Subject "value=" Geography/> <span class= "Checkbox_span" > Political history Student </span></p>//js part
v Ar val= ';//gets all selected data $ ("input[type=checkbox]:checked"). each (function (index, Element) {Val +=$ (this). Val () + "; Remove comma//Val +=$ (This). Val () + ', '; Val =val.substring (0, val.length-1); } }