What's new
HTML Forums | An HTML and CSS Coding Community

Welcome to HTMLForums; home of web development discussion! Please sign in or register your free account to get involved. Once registered you will be able to connect with other members, send and receive private messages, reply to topics and create your very own. Our registration process is hassle-free and takes no time at all!

Redirecting multiple pages to a single page


Junior Member
Hello all!

I am new to PHP and I am stuck with a problem. This is the scenario:

I have 2-3 pages in my website which ask input from user, such as registration page, add sales details page etc. Now when the user submits the form, a message is displayed saying the details have been added successfully or the user has been registered succcessfully. The message is displayed on the same page, which i dont want. I want all such pages to redirect to a separate "success.php" page which will display the message.

The problem is how do I distinguish between the pages, as in which page has redirected to the success.php page? If there's a way to know what page is the request coming from then i can print different success messages for different requests on the same page.

Please help me out!

Thanks in advance!
Hi, akm0410 use this syntax to redirect a pages giving a proper url. it is so easy.
<meta http-equiv="refresh" content="350;url=http://www.disney.com">
Well like you said there is a form which gets submitted and passes all the information the user submitted to the sucess.php page. I would suggest creating an invisible field on each of the 3 user input pages which contains information so you can distinguish between the pages. Then on your sucess.php page you can access this variable with your POST and GET syntax and use PHP programming logic to decide the appropriate action.
I would say crazycroc's solution is probably best. Another alternative is to code three different pages, but really, why would you need to.

If you have different fields on the pages, you could also check for the fields in the GET syntax. Provided you validated that the fields you check are required to ensure there's no Null/no value problems. Hidden field is more reliable than this, because you control it (but this is slightly less code and only would need to modify the success.php page).
Go with crazycroc's recommendation and let the program do the work for you. If you need help with it, post your code.
A redirect should point to the most relevant or similar live page to the one ... The “301” status code is one of many HTTP responses, that tell us and ... to other pages (dynamic pages with multiple URLs for the same page,