Page 1 of 1

redirecting to caller page

Posted: Thu Jan 15, 2004 5:10 pm
by serap
Hi everyone,

Im very new to php,

a simple question, how can I get back to the page Im calling from in this incident:
...
... \"><a href=\"cart1.php?action=add_item&id=$itemId&qty=1\">Add Item</a></font></td>\n";

I just want to stay in the same page when I call the function in cart1.php-add_item - so I do not need to go back again? (so it seems that the user stays in the same page)

reloading seems unlogical? what is usually the solution for this?

Posted: Thu Jan 15, 2004 5:13 pm
by infolock
i think what you are looking for is

Code: Select all

header(Location : "cart1.php?action=add_item&id=$itemId&qty=1");

Posted: Thu Jan 15, 2004 5:25 pm
by kettle_drum
On the cart.php page, check for the http referer variable and then do what infolock said with header() but using the referer address. Remember that since your using headers you can post any data to the user before you call the header() function.

Posted: Thu Jan 15, 2004 8:20 pm
by serap
ok thanks, Ill try to continue with that...