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

anand_aks's avatar

Saving redirecting parameter in session

My client's website is www.sweetfood.com, and there is a button that redirects to my application www. orderfood.com for online food ordering.

While redirecting I am passing the company code as a parameter like

www.orderfood.com/{company_code}

and saving it on the session for further use. But if the session is expired company_code is null, so that I can not return it to the client's website. since I don't have company_code.

Is it better to use config() for saving the value, or any other ways

0 likes
6 replies
jlrdw's avatar

Setup some relations and pass company_code as a parameter or pass in a query string.

Snapey's avatar

You should only lose the session after 2 hours. Are the customers waiting that long to return?

NO, don't use config. It would not work.

Session should work, but failing that, give the customer a cookie with the referrer details.

jlrdw's avatar

Also, since this is a separate web site, are you ensuring the data came from a trusted source?

Snapey's avatar

its a referral. Where is data mentioned?

jlrdw's avatar

Missed that, thought it was to place an order.

SachinAgarwal's avatar

@anand_aks you can prefix all of your route with following pattern www.orderfood.com/c/{company_code}/ in this way you will have company_code in all the routes and request.

In any case if you can keep prefix then you can use company_code as request parameter like this www.orderfood.com/your-awsome-route?company_code=1234 And once again you will have company_code in all your routes the only catch with this approach is, then you will have to make sure you are handling the empty value for the param company_code

Please or to participate in this conversation.