Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

GiacomoM's avatar

Hide token in GET form

Hi everybody, I have a GET form with token hidden field.

The problem is the result of the form, that does have the token field in the url.

How can I hide it?

Thanks

0 likes
4 replies
devtraining's avatar

the token should not be append when using get and for builder. Are you doing manual form ?

GiacomoM's avatar

This is the code:

<form method="GET" action="{{ URL::route('main_search') }}" name="do_main_search">
        {!! csrf_field() !!}
...

should I remove the field?

michaeldyrynda's avatar
Level 41

Generally CSRF is used to protect routes that make changes to database, so a GET request (probably) doesn't need one. In either case, whether in the URL or in the HTML, it's easy enough to get the token. I wouldn't be overly concerned about it.

2 likes

Please or to participate in this conversation.