Home >Backend Development >PHP Tutorial >Some problems encountered by personal php mysql database

Some problems encountered by personal php mysql database

不言
不言Original
2018-04-20 11:32:191127browse

The content of this article is about some problems encountered by personal PHP mysql database. It has certain reference value. Now I share it with you. Friends in need can refer to it.

1. About a The two forms on the page submit data to the database

You only need to set the buttons for submitting data to different class attributes or id attributes; perform separate submissions and write js separately; it does not affect the submission of data at all

2. Enter the check box information into the mysql database

Set the same class attribute for all input boxes; then enter the following code when making an ajax data request


<p class="checkbox_p">   
<input class="checkbox subject" type="checkbox" name="subject" value="全科" />   
<span class="checkbox_span">全科</span>   
<input class="checkbox subject" type="checkbox" name="subject" value="语文" />   
<span class="checkbox_span">语文</span>   
<input class="checkbox subject" type="checkbox" name="subject" value="数学" />   
<span class="checkbox_span">数学</span>  
 <input class="checkbox subject" type="checkbox" name="subject" value="英语" />   
 <span class="checkbox_span">英语</span></p><p class="checkbox_p">   
 <input class="checkbox subject" type="checkbox" name="subject" value="物理" />   
 <span class="checkbox_span">物理</span>   
 <input class="checkbox subject" type="checkbox" name="subject" value="化学" />   
 <span class="checkbox_span">化学</span>   
 <input class="checkbox subject" type="checkbox" name="subject" value="生物" />   
 <span class="checkbox_span">生物</span>   
 <input class="checkbox subject" type="checkbox" name="subject" value="地理" />   
 <span class="checkbox_span">政史生</span></p>
//js部分
var val='';
//获取所有的被选中的数据
$("input[type=checkbox]:checked").each(function (index, element) {
    val +=$(this).val()+' ';    
    //去除逗号    
    // val +=$(this).val()+',';   
    // val =val.substring(0, val.length - 1);
    }
    }

       

The above is the detailed content of Some problems encountered by personal php mysql database. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn