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

harkeerat2000@gmail.com's avatar

Getting a URL separator (?) with a variable or something

I'm using Laravel 5.8 to develop a project. I have a page which contains a button, clicking on it will redirect you to a registration page. This button is located in multiple pages, so, when the button is clicked, I want the name of the page from which it was clicked to be shown in the URL.

For Example, a youtube video contains, /watch?v=dQw4w9WgXcQ in its URL which indicates the id of the video playing as v=dQw4.... That is what I want to have in my URL, where "watch" would be the current page's name, and v would contain the name/id of the previous page. I have posted the button and the routes below. Let me know if something else is required.

< a href="{{ url ('demo' )}}" class="set-btn btn3" >Request a Demo Route::get('demo','Controller@dropdown_data'); Route::POST('demo','Controller@submit');

The get route calls a function to retrieve data for dropdown fields from a database. The post route calls the function for submission of the details.

0 likes
0 replies

Please or to participate in this conversation.