CodeIgniter Forums
How to properly use GET attributes - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: How to properly use GET attributes (/showthread.php?tid=68462)



How to properly use GET attributes - glorsh66 - 07-13-2017

So it's really simple question, but i have to be sure that i make it in a right way 
I want to implement GET parameters for filtering
so i wanna get something like - mysite.com/cars/ford/?price_from=10&price_to=20
In this case - GET parameters are optional, and there could be a lot of them.
I don't want users to see PHP file. mysite.com/cars/ford/index.php?price_from=10&price_to=20 (or something like that)

So how do i properly implement this? I mean follow the codeigniter path

Just manually check native PHP - $_GET ?
And how do i setup route table?


RE: How to properly use GET attributes - ciadmin - 07-13-2017

You can enable query parameters if you want to use those for routing ... https://www.codeigniter.com/user_guide/general/urls.html#enabling-query-strings

If you just want to access query parameters ... then https://www.codeigniter.com/user_guide/libraries/input.html#accessing-form-data


RE: How to properly use GET attributes - glorsh66 - 07-13-2017

Do i need manually sanitize input data?


RE: How to properly use GET attributes - Narf - 07-14-2017

(07-13-2017, 10:32 AM)glorsh66 Wrote: Just manually check native PHP - $_GET ?

Yes.

(07-13-2017, 12:15 PM)glorsh66 Wrote: Do i need manually sanitize input data?

Validate, not sanitize.

Validation means rejecting invalid data.
Sanitization means trying to clean the shit of whatever you get, even if all you get is shit.