Jump to content

Redirection Question


ImJustBrndn

Recommended Posts

I've got a fully working shopping cart script that I created. I have everything working just fine, but for a final addon I would like it so when you click the link to add a product to your cart that it redirects you to the shopping cart or to some kind of verification page. Does anyone know how to do this, do I need to add something into my cart_func.php script. The link to add something to my cart is:

http://www.mydomain.com/folder/Cart_func.php?act=add&pid=1

Thanks,
Brandon
Link to comment
Share on other sites

Keep in mind that you must have an intermediary page (or at least the processing code) between the clicking of "add to cart" and the header() call.

I assume you're putting all of your items in a form.  So when the action of the form that has the "add to cart" button should be something like "<form action="Cart_func.php?act=add" method="post">"  Then of course your pid would be passed from the form itself, or however you're handling it.

Cart_func.php should be nothing but the processing of adding that item to the shopping cart and then the header() call to go to the actual cart page.  This also provides the added bonus of not having the user hit refresh and add the item to the cart again.

I hope that all makes sense.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.