Reputation: 43
sorry i a begginer of php. I have url example here: http://example.com?category=software-hardware .Actual of category is Software & Hardware I using this script to get url above
foreach ( $key as $value ) {
$c = array(' ', '&-');
$d = array('-', '');
echo "<a href=\"category/".strtolower(str_replace($c, $d, $value->kategori_laporan))."\" class=\"list-group-item\">".$value->kategori_laporan."</a>";
}
How To get data from my condition url.? Sorry, i bad using english. I want to create url like category from slideshare. Please help me.! Thanks.!
Upvotes: 0
Views: 1548
Reputation: 5246
$_GET
is an associative array having all the query string keys values.
You can get value of any query string parameter from this array by passing the key of query string parameter.
To get category you can use $_GET["category"]
in your case.
Upvotes: 0
Reputation: 1447
you can fetch it like:
$cat = $_GET['category'];
and you don't need any foreach
Upvotes: 1