Jump to content

Recommended Posts

When I'm coding asp/.net I frequently want to redirect users after I've run some code - eg for a news posting system I'd have a form send to an asp page that'd insert to the database and then redirect them back where they were.

 

Can anyone tell me what the command is for php? Have dug around, but most redirects seem to be limited to 301-style execution (ie at top of the page before code)

Link to comment
https://forums.phpfreaks.com/topic/171809-rediredt-on-form-finish/
Share on other sites

header is, I guess what you called a 301 style execution. it needs to be executed before any output is sent (IE at the top of the page). Beyond that, I don't think PHP has any other ways to redirect a user. You can use meta tags to redirect a user, as well as javascript, (but both of those can be disabled, so these may want to be avoided).

that's strange - so I'd normally have a form on a page that sends the data in post to a 'processing' page which then bounces the user back to the original page.

 

Would you normally use the header option for this? (or is there some other method entirely in php?)

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.