Returning to the previous page, in the previous position

HTML, CSS and anything else that deals with client side capabilities.

Moderator: General Moderators

Post Reply
monicao
Forum Newbie
Posts: 2
Joined: Mon Mar 01, 2010 1:08 pm

Returning to the previous page, in the previous position

Post by monicao »

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:

Code: Select all

 
<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:

Code: Select all

mysql_query($sql1);
mysql_query($sql2);
$_GET['id_subdomeniu']=$row["id_subdomeniu"];
include("domain.php");

Code: Select all

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?
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: Returning to the previous page, in the previous position

Post by AbraCadaver »

Try:

Code: Select all

header("location: domain.php?id_subdomeniu={$row['id_subdomeniu']}#product{name}");
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Post Reply