Skip Submit button in array
This question already has an answer here:
从阵列中删除它...
$post = $_POST;
unset($post['submit']);
$data = array_values($post); // get only values
$headers = array_keys($post); // keys are headers
Drop the name from the Submit button in your html
and instead of
if(isset($_POST['submit']))
use
if($_SERVER["REQUEST_METHOD"] == "POST")
array_pop()
将删除数组的最后一个元素:
$data = array_pop(array_values($_POST)); // get only values
$headers = array_pop(array_keys($_POST)); // keys are headers
链接地址: http://www.djcxy.com/p/30100.html
上一篇: 删除数组中一行的元素
下一篇: 在数组中跳过提交按钮