L
L
LP-DIMAN2015-11-14 13:41:01
Laravel
LP-DIMAN, 2015-11-14 13:41:01

Why can't I process data from a form in laravel?

Here is a piece of the template:

<form action="admin_suc" method="get">
          @foreach($admin as $administrator)

 			<strong>{{$administrator->name}} {{$administrator->surname}}</strong> просит разрешения стать риэлтором<br>
          <a href="admin_suc?id={{$administrator->id}}"><button type="button" class="btn btn-success" name="success">Подтвердить </button></a>
          <a href="admin_suc?id={{$administrator->id}}"><button type="button" class="btn btn-danger" name="cancel">Отклонить</button><br></a>
          
          @endforeach
          
          </form>

Here is the route: And here is the function:
Route::any('admin_suc','[email protected]');
public function get()
  {
    $request = new Request();
    
    
    if ($request->input('success')){
      Admin::confirmation_realtor($id=2,$confirmation_realtor=2,$id_role=3);
      echo 1;
    }
      else if ($request->input('cancel')){
      Admin::confirmation_realtor($id,$confirmation_realtor=0,$id_role=2);
      echo 2;
    
  }


}

There are two buttons: Confirm and Reject. When I click on one of them, I should have an update in the database. But that's not the point. The interpreter simply does not recognize the button being pressed and returns null, as if the button was not pressed. What is the problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Ukolov, 2015-11-14
@alexey-m-ukolov

laravel.com/docs/5.1/requests#accessing-the-request
In the template, you have some kind of horror going on - a form, inside of which are buttons, inside of which are links, and all this with relative addresses.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question