POST in PHP AND redirect the user to that page?

独自空忆成欢 提交于 2019-12-01 21:19:07

You cannot redirect POST requests. As simple as that. Any redirect will always turn into a GET request.

If you want to receive POST data, then send that data to another page, you have two choices:

  • if both pages are on the same server, use sessions to save the data server-side, don't make the client carry it over
  • if the destination is on another server and you need to send the client there together with the data, set up another intermediate form like you are

Use AJAX to save the data before you leave the page. Use the answer you get back to fire a redirection to the new url right within the current page. Don't be affraid of Javascript and ajax. Try this light AJAX library: http://www.openjs.com/scripts/jx/

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!