怎麼控制一數組中的資料那些可儲存!

來源:互聯網
上載者:User
如何控制一數組中的資料那些可儲存!!!
首頁
列表頁
內容頁

當我只勾選了,首頁 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');
foreach($_POST['post']['top'] as $k) {
$postdb['css'][$d[$k]] = $_POST['postdb']['css'][$d[$k]];
}
  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    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.