Reputation: 81
I am passing parameters from one page to another page in PHP here is the code :-
<a href="index.php?product.php&category_id=<? echo $Getrow['id'];?>" target="_blank">Detail</a>
Now when i clicked on detail link it shows product page but at this page category_id is showing for example category_id=15 thus i don't want to show it rather then this id i want show category name using .htaccess please help me
I want its answer because when we pass query string like example.com/index.php?category_id=15&product_id=13 at this time someone can change it like example.com/index.php?category_id=156546565464654&product_id=13546545484 I don't want this thing.
Upvotes: 1
Views: 795
Reputation: 199
I do something similar.
When I create a link, I create the link in from of a text using variables, like <a href="category-15">click me</a>
Then in .taccess I do this
RewriteEngine On
RewriteRule ^([a-zA-Z0-9_-]+)-([0-9]+)$ search.php?id=$2
and then the link http://example.com/category-15
takes me to http://example.com/search?id=15
I think, you can change the variables in the htaccess for your needs, you just need to use $1, $2, $3 etc for replacement. I hope this helps.
EDIT: I edited the example url, for consistency.
Upvotes: 0