0
votes

I am trying to do a create functionality where if a user accepts the terms and condition, it would go to page where the user can fill up something but when I try to click the button for terms and conditions, it would give me this error:

SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'title' cannot be null (SQL: insert into `reserves` (`title`, `lastname`, `firstname`, `middlename`, `birthday`, `city`, `streetadd`, `zipcode`, `country`, `home`, `work`, `fax`, `mobile`, `email`) values (, , , , , , , , , , , , , ))

I couldn't get through the page. I couldn't even get to the form page where you get to fill up things. How come this happen? What step should I make to make this work?

Here are my codes:

Routes:

Route::get('/','OnewayflightController@index');
Route::get('flight/onewayflight','OnewayflightController@onewayflight');
Route::post('flight/onewayflight','OnewayflightController@onewayflightresults');    
Route::post('flight/onewayflightresults','OnewayflightController@onewayflightterms');
Route::post('flight/onewayflightterms','OnewayflightController@onewayflightfillup');

OnewayflightController.php

 public function onewayflightterms()
   {  
      return View::make('content.onewayflightterms');
   }

   public function onewayflightfillup()
   {
      $reserve = new Reserves;
      $reserve->title     = Input::get('title');
      $reserve->lastname    = Input::get('lastname');
      $reserve->firstname= Input::get('firstname');
      $reserve->middlename = Input::get('middlename');
      $reserve->birthday = Input::get('birthday');
      $reserve->city = Input::get('city');
      $reserve->streetadd = Input::get('streetadd');
      $reserve->zipcode = Input::get('zipcode');
      $reserve->country = Input::get('country');
      $reserve->home = Input::get('home');
      $reserve->work = Input::get('work');
      $reserve->fax = Input::get('fax');
      $reserve->mobile = Input::get('mobile');
      $reserve->email = Input::get('email');

      $reserve->save();
   }
1
Obviously you should try var_dump(Input::all()) first, cause it seems like you get no values from your inputsDanny
@Danny thanks for the quick reply Sir. I have added something my question.staphhelpme
You should provide more code. What route are you trying to access? What's the controller method code for this route?Marcin Nabiałek

1 Answers

1
votes

Here is definitely problem with your routes.

There is no get route that leads to OnewayflightController@onewayflightterms

So double-check your routes, most likely the error you get is because your routes lead to wrong methods.