开发者

Is it possible to redirect a user to a remote page, and send POST parameters with it?

开发者 https://www.devze.com 2023-01-08 19:04 出处:网络
For example, I\'m working on a开发者_StackOverflow社区 webpage where a user can apply to join a group.

For example, I'm working on a开发者_StackOverflow社区 webpage where a user can apply to join a group.

When they click 'Apply' I want it to redirect them to a forum we're members of, more specifically the Private Messaging system, with the subject and body already filled out.

Is this even possible?

The forum is off server, by the way. Owned by someone else.


It's entirely possible, and PHP provides a nice http_redirect function just for this purpose.

http://us.php.net/http_redirect

Filling out form fields when they get there is another matter. You can try POSTing the data to the page using the same names the form uses and see if it persists the data. If so, you can write some javascript to have the user's browser post a dummy form to that page containing the prefilled info instead of doing a straight HTTP redirect.


You could issue a status code 307 (Temporary Redirect) with your redirect. Firefox neatly pops up telling you that you are redirected, and asking if you want to re-post your data.

I wouldn't recommend it, but to answer your question: yes it is possible, with just one line

header("Location: ...",true,307);
0

精彩评论

暂无评论...
验证码 换一张
取 消