0
我有一個簡單的用戶名和密碼錶單,我如何將通過用戶輸入的值傳遞到我的php數組中?將表單值傳遞到我的PHP數據數組中
我的數組
$post_data = array(
'username' => 'user',
'password' => 'pass#',
);
形態 - 陣列
<form action="">
<div class="">
<label><b>Username</b></label>
<input type="text" placeholder="Enter Username" name="uname" required>
<label><b>Password</b></label>
<input type="password" placeholder="Enter Password" name="psw" required>
<button type="submit">Login</button>
</div>
</form>
<?php
session_start();
$service_url = 'http://localhost/app/sapi/user/login.xml'; // .xml asks for xml data in response
$post_data = array(
'username' => 'user',
'password' => 'pass#',
);
$post_data = http_build_query($post_data, '', '&'); // Format post data as application/x-www-form-urlencoded