张贴到表单发送到另一个表单 [英] POST to a form that POSTS to another form

查看:132
本文介绍了张贴到表单发送到另一个表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从外部网站,我需要提供一个表单,将POSTS数据保存到secure.domain.com/index.php。在index.php里面,我填充了一些隐藏的字段,这些字段又需要发布到secure.domain.com/foo/index.php。我也设置了一些会话变量。



原因是这是一个临时重定向,而我完成了一个用户门户网站,它将在secure.domain.com/上生存。在几个星期内,我只需要将数据发布到secure.domain.com/index.php。



然而,现在,我需要尝试自动记录人们进入secure.domain.com/foo/。我不能只是改变各种网站上的表格的目标。



我可以用PHP来完成这个任务吗?现在,我只是在secure.domain.com/index.php上提供点击此处完成登录提交按钮,我希望摆脱那个按钮。



B计划是在按钮上方放置一个验证码,并告诉管理人员,这个特殊设计是为了人工验证而设计的,因为外部站点表单上没有空间。


$ b

编辑:



感谢所有人的答案。似乎没有办法只用 来使用PHP。内部用户将使用一个非常严格的预先配置的noscript插件的瘦客户端,他们可以在几个星期内处理该按钮。

解决方案您可以使用JavaScript自动发布第二个表单:

 < script> document.forms [0] .submit()< /脚本> 

这是我能想到的最简单的方法,但我不是一个专业的网络人员;)



对于JavaScript禁用的用户,您还应该保留当前按钮并在其周围包装< noscript>



编辑:如果您使用JQuery,Wookai的答案将是更好的解决方案。但保持无脚本按钮。

From an external site, I need to present a form that POSTS data to secure.domain.com/index.php. Inside of index.php, I fill some hidden fields which in turn need to be posted to secure.domain.com/foo/index.php. I also set some session variables.

The reason for this is a temporary redirect while I finish building a user portal which will live at secure.domain.com/. In a couple of weeks, I will just need to post data to secure.domain.com/index.php

For now, however, I need to try and automatically log people in to what lies in secure.domain.com/foo/. I can't just change the target for the forms on various sites.

How might I accomplish this with PHP? Right now, I'm just presenting a "Click here to complete login" submit button on secure.domain.com/index.php , I'm hoping to get rid of that button.

Plan B is to put a captcha above the button and tell management that the quirk is by design for human verification purposes, since there was no room for one on the external site forms. I'd rather not do that.

Edit:

Thanks for all of the answers. It seems like there is no way to do this only using PHP. Internal users will be using thin clients with a very strict pre configured noscript plug-in, they can just deal with the button for a couple of weeks.

解决方案

You could automatically post the second form using JavaScript:

<script>document.forms[0].submit()</script>

This is the simplest method I can think of but I'm not an expert web guy ;)

You should also keep your current button and wrap a <noscript> around it for users with JavaScript disabled.

Edit: if you are using JQuery, Wookai's answer would be a better solution. But keep the noscript button.

这篇关于张贴到表单发送到另一个表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆