What's new

Welcome to the forum 👋, Visitor

To access the forum content and all our services, you must register or log in to the forum. Becoming a member of the forum is completely free.

Redirecting multiple pages to a single page

akm0410

Junior Member
Joined
Apr 23, 2013
Messages
1
Reaction score
0
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,
 

Theme customization system

You can customize some areas of the forum theme from this menu.

  • Wide/Narrow view

    You can control a structure that you can use to use your theme wide or narrow.

    Grid view forum list

    You can control the layout of the forum list in a grid or ordinary listing style structure.

    Picture grid mode

    You can control the structure where you can open/close images in the grid forum list.

    Close sidebar

    You can get rid of the crowded view in the forum by closing the sidebar.

    Fixed sidebar

    You can make it more useful and easier to access by pinning the sidebar.

    Close radius

    You can use the radius at the corners of the blocks according to your taste by closing/opening it.

  • Choose the color combination that reflects your taste
    Background images
    Color gradient backgrounds
Back