monicao Posted March 1, 2010 Share Posted March 1, 2010 Hello! My problem is a HTML and a PHP one... I don't know if I correctly posted this problem. In a page with a list of products (domain.php), I've put anchor to each product in this way: <a name="product'.$row['name'].'"></a> One user adds a product into his cart. I have another page who makes the adding operation into MySQL database (add.php). After the product is add into the cart, I want that browser returns in the page with the list of products (domain.php) in the same position of the last added product. Add.php: mysql_query($sql1); mysql_query($sql2); $_GET['id_subdomeniu']=$row["id_subdomeniu"]; include("domain.php"); [code] My code is functioning, but it doesn't determine the browser to return in the position of the last product... I thought to use header("location:domain.php#product'.$name.'" or <echo ...> using the anchor, but in these cases the code doesn't transmit to domain.php the variable $_GET['id_subdomeniu']=$row["id_subdomeniu"]; and I get an error because domain.php don't have the value of $_GET['id_subdomeniu']. Please, can you help me to solve this problem? Quote Link to comment https://forums.phpfreaks.com/topic/193805-returning-to-the-previous-page-in-the-position-of-last-added-product/ Share on other sites More sharing options...
Psycho Posted March 1, 2010 Share Posted March 1, 2010 There's no reason you can't simply redirect to the page adding tyhe anchor tag on the end. BUt, if this is the code you are using, it is wrong header("location:domain.php#product'.$name.'") You are defining the location in double quotes and then apparently try to add the $name within single quotes. Try this: header("location:domain.php#product{$name}") Quote Link to comment https://forums.phpfreaks.com/topic/193805-returning-to-the-previous-page-in-the-position-of-last-added-product/#findComment-1020093 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.