php shopping cart
free shopping cart   shopping cart software

Free Shopping Cart PHP Software


Back to Functions List
This Function Has Been Available Since:
(AFCommerce v 2.1,     Functions v 1.1)

Redirects the current page and exits.


string = afc_redirect_page (redirect_to_pagename)

This is AFCommerce's redirect function. I did not use a normal php redirect which would be the "header" function, because that function has a much higher chance of failing than a JavaScript redirect, which will always redirect the page. If any output is displayed to the screen before the php header function is called, including an error or warning message, the redirect will fail and an additional warning message will normally appear. By using JavaScript, which this function does, I can print the redirect script to the page at any time and the page will automatically redirect, so this makes it MUCH more flexible. You can start printing output early (which would be a mistake), or have an error message, and the redirect script will still execute and leave the page. This way the developer should still be able to realize some kind of message is being printed to the screen (like an error), but the customer will not be slowed down and can continue on without realizing something bad happened. This could only temporarily fix a minor problem, where some random error or warning is printed and your site would still run smoothly. I figured every little bit counts in ecommerce.

This script will also exit the current page immediately after the redirect, which is normally you should do when ever using the header function to prevent any other code from executing. So you will use this function a lot, look at the many examples through out the cart, you can leave the page with very little code by using this function.


redirect_to_pagename (string) - The page to be redirected to. This can be a relative or full (real) path.

Return Values

This function has no return value.

Open Source: Yes

Paul's Examples

There are currently no examples for this function.

Back to Functions List


There are currently no posts for this topic.

AFCommerce Documentation

High End Website DevelopmentCompletely Free
Dating Service
Copyright 2004 - 2006
AFCommerce Website
And Cart Builder