PHP表单字段到数组

时间:2015-05-15 16:54:23

标签: php forms post

未添加数据

$user = array(); 
$user['First Name'] = $_POST['first']; 
$user['Last Name'] = $_POST['last'];
$user['Username'] = $_POST['username'];
$user['Password'] = $_POST['password'];

1 个答案:

答案 0 :(得分:2)

你的代码错了。

你需要使用这些:

$user = array();

$user['First Name'] = $_POST['first'];
$user['Last Name'] = $_POST['last'];
$user['Username'] = $_POST['username'];
$user['Password'] = $_POST['password'];