Jump to content

PHP Redirect


jermaindefoe

Recommended Posts

i have a shopping cart that i dont want to be seen, i just have used an include cart page where i want the conetnes to be displayed, however when a user adds to the cart the contents are displayed on another page

 

i no i can redirect the user if the pages are in a static form, but the pages i want to redirect to are dynamically chosen based on a value

 

for example the iser enters the website and choosees a country as a link, this country has a specific id and the next page is  dependant on the id as products for that id only are shown, however the cart is a generic type for all pages, how do  i redirect in respects of the id?

Link to comment
https://forums.phpfreaks.com/topic/182412-php-redirect/
Share on other sites

Use a GET variable. You've seen them before, they usually look like http://google.com?s=php%20%freaks in the address bar. Here, the variable is 's' amd it is equal to 'php freaks'.  In your case it would look somethingon cart.php  like http://yoursite.com/cart.php?pid=xxxx where pid is your product id. You can retrieve this value  by using something like

 

if(isset($_GET['pid'])) {
$pid = $_GET['pid'];
//do your database calls here to retrieve product info
//display your info
}

Link to comment
https://forums.phpfreaks.com/topic/182412-php-redirect/#findComment-962580
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.