Passing a variable from URL in query

2 posts by 2 authors in: Forums > CMS Builder
Last Post: July 19, 2018   (RSS)

By leo - July 19, 2018


Your url parameters will all be in the variable $_REQUEST. For example if you url looks like this: index.php?video_category=2, you will have this variable $_REQUEST['video_category'] equals 2. So your where statement can be something like this: 'video_category = "%\t' . $_REQUEST['video_category'] . '\t%"'. Note that if you didn't pass "video_category" parameter in the url and call $_REQUEST['video_category'], it will give you an error sayting $_REQUEST['video_category'] doesn't exist. So it's better to do an if(empty($_REQUEST['video_category'])) check before using it.

Let me know if you have any questions!


Leo - PHP Programmer (in training)