Home > Backend Development > PHP Tutorial > 怎么控制一数组中的数据那些可存储!

怎么控制一数组中的数据那些可存储!

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-13 11:48:19
Original
863 people have browsed it

如何控制一数组中的数据那些可存储!!!




当我只勾选了,首页 post[tpl]=1 时,那么就代表 postdb[css][index] 有写数据,没勾选代表没写数据,在存储的时候,只存储勾选的,
如果全部勾选了,那么下面三个数据并成一个数据放到字段中,如果都没勾选,那就是空!请大虾帮忙这段怎么写? 怎么去控制数组





这是我的存储格式!
      
$postdb[css][email protected]($postdb[css]);

最后的会把结果 $postdb[css]放到数据库字段中
------解决方案--------------------


改成

后,php端$_POST['post']['tpl'] 就是一个数组了,然后遍历控制$_POST['postdb']['css'] 就是了。
------解决方案--------------------
name="post[tpl]" 应写作 name="post[tpl][]"
否则只能接收到单值

$d = array(1 => 'index', 2 => 'list', 3 => 'bencandy');<br />foreach($_POST['post']['top'] as $k) {<br />  $postdb['css'][$d[$k]] = $_POST['postdb']['css'][$d[$k]];<br />}<br />
Copy after login

Related labels:
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template