mardi 3 avril 2018

how to get form data and insert into whmcs in laravel

My Route code is shown below:

 Route::get('insert', 'ProductController@insertform');
 Route::post('insert', 'ProductController@insert')->name('product.insert');

My action code is as follows:

 <form class="container" action="" id="needs- 
 validation" method="post" novalidate>

My controller code is given below:

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.';

     }
     }

The output which I got is given below:

  > 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.

Give me an idea how to post these client details into whmcs using API.



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2Eg3lmE
via IFTTT

Aucun commentaire:

Enregistrer un commentaire