2 回答

TA貢獻1946條經驗 獲得超4個贊
您需要通過其索引獲取所有字段:
<?php
require_once '../../../wp-load.php';
global $wpdb;
$newdb = new wpdb( 'user' , 'pass' , 'table' , 'localhost' );
if(isset($_POST['submit'])) {
$username = $_POST['username'];
$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$county = $_POST['county'];
$street = $_POST['street'];
$city = $_POST['city'];
$ward = $_POST['ward'];
$precinct = $_POST['precinct'];
$id = $_POST['id'];
$is_active = $_POST['is_active'];
if(is_array($_POST['username'])) {
foreach($username as $index => $value) {
// You can get all other items by array[$index];
// Example: $street[$index]
// If you include array items inside a string
// enclose it between curly braces
echo "Username: $value, First name: {$first_name[$index]}<br>";
}
}
}
?>
- 2 回答
- 0 關注
- 121 瀏覽
添加回答
舉報