laravel link problem

hi all i am using form get method in my controller

<form action="{{url('employers/blacklist-log/'. $task->id) }}" method="get">

                                {{ csrf_field() }}

link in address bar after pressing submt button is http://localhost/premier_web/public/employers/blacklist-log/19?_token=fKldp1vvH0Fqzjjpw6KeRRAWZ49BDajtmlo29aJx

iwant to know how to remove token from the link to be http://localhost/premier_web/public/employers/blacklist-log/19

lagbox replied 4 months ago

Remove the csrf_field as that is what that is.

mainul94 replied 4 months ago

Remove the csrf_field. Or Change the method GET to POST

FrontEndCoffee replied 4 months ago

The csrf_field() function creates a hidden field in your form with the name _token that contains a csrf token. Because of how the <form> element in html works all form fields will be sent as variables in the url if you are using method=GET.

However, if you change your method to POST, the form fields will be sent in the http request body.

TLDR; if you don't want your form fields to be visible in the URL, you cannot use GET.

Sign in to participate in this thread!

We'd like to thank these amazing companies for supporting us