如何从我未主持的在线预填充表单答案? [英] How Do I Pre-Populate Form Answers For An Online From That I Am Not Hosting?

查看:168
本文介绍了如何从我未主持的在线预填充表单答案?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经尝试了?id / name ='value'但是无论我尝试了多少变化,它似乎都无法工作。



我正在为我的部门工作,他们只是要求我帮助生成一个表格的链接,该表格已经预先填充了下拉列表的值,以便于查看/访问。





i检查了不同的论坛并查看了各种页面来源沙子似乎格式?id / name ='value'应该是要走的路。所以我做了一个虚拟表格来测试/检查它是否真的有效,瞧...它没有。我真的希望你能帮助澄清这个疑问。



只是为了踢,这是我用来玩的虚拟下拉列表/表格:

< br $> b $ b

< html>< header>< / header>< body>



< select id =list>



< option value =

< option value =Cake> cake< / option>

< option value =Soap> soap< / option>

< option value =table> table< / option>





< / select>



< / body>< / html>



然后我尝试了http / * directorylocation * / ..?id = Soap



请你帮忙解决我做错了什么?

ive tried ?id/name = 'value' but it doesnt seem to work irrespective of how many variations i try.

Im working on something for my department, and they just require that i help generate a link for a form with an already prepopulated value for a drop down list to allow for easier view/access.


i checked out different forums and viewed various page sources sand it seems like the format ?id/name = 'value' is supposedly the way to go. So i made a dummy form to test/check if it really works and voila...it doesnt. Im really hoping you can help clarify this doubt.

Just for kicks this is the dummy dropdownlist/form i was toying with:


<html><header></header><body>

<select id = "list" >

<option value = " "
<option value = "Cake"> cake </option>
<option value = "Soap"> soap </option>
<option value = "table"> table</option>


</select>

</body></html>

and then i tried http/*directorylocation*/..?id=Soap

please can you help out with what im doing wrong??

推荐答案

请看我对这个问题的评论。



填写此类表格是错误的做法。您不希望填充任何内容,如果这是在您自己的网站的服务器端使用的PHP,则您无法执行此操作,因为您也不会托管执行此填充的Web浏览器。这不合逻辑吗?



解决方案是:你必须意识到你真正想要的不是任何用户界面。你真正想要的是获得与填充然后提交表单或发送任何其他HTTP请求的Web浏览器用户相同的效果。



如果你意识到这一点,你可以轻松(好吧,相对容易)解决这个问题。您只需要使用PHP类发送适当的HTTP请求 HttpRequest

http://php.net/manual/en/class.httprequest.php [ ^ ]。



你可能会遇到一些问题完全发送和HTTP响应中的预期。我可以给你一个秘密武器。这可能是用于在使用某些浏览器手动试验相关网站时窥探HTTP请求/响应的任何Web浏览器工具。这样,您可以获取所有详细信息,然后在HTTP请求和处理HTTP响应的代码中模仿它们。这样的工具可以称为HttpFox(Mozilla),HTML Spy等。



-SA
Please see my comment to the question.

Populating of such form is wrong approach. You don't want to populate anything, and if this is PHP used on the server side of your own Web site, you cannot do it, because you also don't "host" a Web browser which does this population. Isn't it logical?

The solution is: you have to realize that what you really want is not population of any UI. What you really want is to get the same effect as the Web browser user who populates and then submit a form, or send any other HTTP request.

If you realize that, you can easily (well, relatively easily) solve this problem. You just need to send appropriate HTTP request(s) using the PHP class HttpRequest:
http://php.net/manual/en/class.httprequest.php[^].

You might have some problems figuring out what exactly to send and what to expect in HTTP response. I can give you one "secret weapon". This could be any Web browser tool used to "spy" on HTTP request/response while experimenting with the site in question using some browser manually. This way, you can fetch all the detail and later mimic them in your HTTP request and the code handling your HTTP response. Such tool can be called "HttpFox" (Mozilla), "HTML Spy", and the like.

—SA


这篇关于如何从我未主持的在线预填充表单答案?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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