我的路线代码如下所示:
Route::get('insert', 'ProductController@insertform');
Route::post('insert', 'ProductController@insert')->name('product.insert');
我的行动代码如下:
<form class="container" action="{{ route('product.insert') }}" id="needs-
validation" method="post" novalidate>
我的控制器代码如下:
class ProductController extends Controller
{
public function insertform(){
return view('clientlayout.main.signup');
}
public function insert(Request $request)
{
$request=array(
// 'action'=>'AddClient'
);
$request["firstname"] = $_POST['firstname'];
$request["lastname"]= $_POST['lastname'];
$request["companyname"] = $_POST['companyname'];
$request["email"] = $_POST['email'];
$request["address1"] = $_POST['address1'];
$request["address2"] = $_POST['address2'];
$request["city"] = $_POST['city'];
$request["state"] = $_POST['state'];
$request["postcode"] = $_POST['postcode'];
$request["country "]= $_POST['country'];
$request["phonenumber "]= $_POST['phonenumber'];
$request["password"] = $_POST['password'];
print_r($request);
echo '<a href = "/insert">Click Here</a> to go back.';
}
}
我得到的输出如下:
> Array ( [firstname] => test [lastname] => ttt [companyname] => gjhkjlkjl
[email] => test@gmail.com [address1] => afdgfhgjh [address2] => hjghkjhkjl
[city] => Adirampattinam [state] => Tamil Nadu [postcode] => 689547
[country ] => India [phonenumber ] => 1458963267 [password] => 123456 )
Click Here to go back.
让我知道如何使用API将这些客户端详细信息发布到whmcs。