Reputation: 1600
I have a switch menu so my pages are called into index.php and then loads the page content from whatever is on the file so I am having to only use the includes files once throughout - I am having an issue though with a link to in my case a single product page view. So the url will be appended with something like products_single.php?prod_id=46
But the way my menus are set it does not recognise this as a valid url as far as I can see?
Here is the function which creates the link:
function settings_layout($page_id) {
switch($page_id) {
default:
echo '<p class="red">Whoops! this page does not exist!</p>';
case '':
// PRODUCTS
case 'products_single':
include_once("modules/products/products_single.php");
break;
}
}
To get to the page products_single
that query lives in the build_prod_list()
which basically just lists out the products from the products table. The name of the product is wrapped in a link a href="index.php?page=products_single?prod_id='.$row["prod_id"].'"> '.$row["prod_name"]. '</a>
Where this is sat in a while loop inside of the build_prod_list()
function.
So as a function I which I am calling build_prods_single()
grabs the product data from the database and shows it on products_single.php
so when the link is clicked the url is index.php?page=products_single?prod_id=46
but shows the error 'Whoops! this page does not exist!'
Upvotes: 0
Views: 49
Reputation: 150
You forgot to add &
ampersand between products_single and prod_id
<a href="index.php?page=products_single&prod_id='.$row["prod_id"].'"> '.$row["prod_name"]. '</a>
Upvotes: 1