Hi here i am trying to get values from database using query in my php page. i am getting values from database to dropdown in loop using php.
here is the html of the output
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Products <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href='product-by-category.php?Aviation'>Aviation</a></li><li><a href='product-by-category.php?beauty & personal care'>beauty & personal care</a></li><li><a href='product-by-category.php?Documentary'>Documentary</a></li><li><a href='product-by-category.php?gaming'>gaming</a></li><li><a href='product-by-category.php?health and fitness'>health and fitness</a></li><li><a href='product-by-category.php?health care'>health care</a></li><li><a href='product-by-category.php?hobbies '>hobbies </a></li><li><a href='product-by-category.php?home '>home </a></li><li><a href='product-by-category.php?misc'>misc</a></li><li><a href='product-by-category.php?mobile accessories '>mobile accessories </a></li><li><a href='product-by-category.php?mobiles'>mobiles</a></li><li><a href='product-by-category.php?Music'>Music</a></li><li><a href='product-by-category.php?office '>office </a></li><li><a href='product-by-category.php?photography'>photography</a></li><li><a href='product-by-category.php?sports'>sports</a></li><li><a href='product-by-category.php?tool & hardware '>tool & hardware </a></li> </ul>
</li>
these values will redirect to page called product-by-category.php with parameter in URL. the parameter will be used to fetch the values from database
when i pass the parameter for e.x sports , i am able to get the results but when i pass tool & hardware as parameter i am not able to get the results because of space and i see tool%20&%20hardware in URL as parameter.
how can i solve this
here is query i am using
"SELECT product_id, product_name, product_price, product_image_URL FROM product_list WHERE product_publish_status='0' and product_category ='$product_category'";
here $product_category is parameter that it will get from url
$product_category = $_SERVER['QUERY_STRING'];
where clausein your query to compare your value??name=value. You don't have a name for the parameter.urldecode()