奇怪的问题:来自隐藏字段的数据不会发送到服务器... [英] Odd problem: Data from hidden field is not sent to server...

查看:63
本文介绍了奇怪的问题:来自隐藏字段的数据不会发送到服务器...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



伙计,


也许有人可以解决这个问题 - 这是''我的剧本的过程''

我有一个表格,我可以在一个地址上添加多个联系人。

只有一个名字/姓氏/电话亭 - 当用户

单击添加按钮,我从表单字段中读取值,并将
记录到隐藏文本输入字段中。这部分是有效的,因为在调试过程中,我已经转换了< input type = hidden>进入< input

type = text>可以确认我的数据被复制到''隐藏''

字段。


一旦用户输入一个或多个名字,他们就可以点击另一个

按钮并提交表格进行处理。我的想法是,然后我会用b $ b解析这个隐藏的现场服务器端...


我有一个基于WAMPHP的服务器并作为测试,我转出我的整个$ _POST

(基本上,每个INPUT标签中的名称和值)。


我的PHP脚本选取每个输入标签的名称,包括隐藏的

字段(就像它应该的那样)但由于某种原因,写入隐藏字段的值不会传递给服务器。因此,对于阅读这篇文章的PHP民间

,我的隐藏输入字段称为mylist并且

$ _POST [''mylist'']存在,但它是空的。即使在处理之前,

我可以在框中看到输入(为了调试记得,我把输入标签框设为

一个正常的,未隐藏的)。 />

以下是我尝试解决的问题:

- 我同时使用了Mozilla 1.7.5和IE6 - 两者都提供相同的结果 -

我的隐藏字段名称被传递,但不是它的值。


- 我创建了另一个隐藏字段并给它一个默认值即我

有< input type =" hidden"名称= QUOT; extraone"值= QUOT; XYZ">我得到了

$ _POST [''extraone''] =" xyz"传递到我的php服务器,就像我期望的那样 -

然而,mylist的值被发送为空,即使它有数据。


- 我有甚至在表单发送之前放入一个javascript警告框

到服务器并且可以在我的(未隐藏)框中看到结果,并且显示相同的

值javascript警报 - 但同样,

mylist的值不会被发送到服务器。

唯一的区别是我的隐藏字段(即使它显示为

普通文本输入框)不会将写入表单字段的数据发布为

javascript函数的结果。有趣的是,服务器

确实知道输入标签框,因为它确实收到了

$ _POST [''mylist''],它只是将它收到空。


给出了什么?如果表单从一个字段读取我的输入,并将其写入

另一个字段,那么它应该被发送到服务器,是吗?


另外。 ..我的标签都在我的< form>< / form>里面标签(通过

双重检查证明,以及我确实将输入标签框名称发送给我的服务器的事实

)。

因为我可以在框中看到数据值,它告诉我我的javascript是

正在做它应该做的事情 - 所以我没有看到包含我的

javascript(虽然我有没有问题,如果有人要求

)。在php服务器上,我使用的是一个简单的phpinfo();检查

数据正在收到...


有没有人对此有任何想法?我已经厌倦了绞尽脑汁

这个 - 我可能会在睡了几个小时后再去睡觉并尝试新的方法...


提前致谢,

Randell D


Folks,

Perhaps someone can figure this out - this is ''the process of my script''

I have a form whereby I can add multiple contacts to a single address.
There is only one firstname/lastname/telephone box - when the user
clicks the add button, I read the values from the form fields and
record them into a hidden text input field. This part works because
during debugging, I have converted the <input type=hidden> into a <input
type=text> to visably confirm my data is being copied into the ''hidden''
field.

Once the user has entered in one or more names, they can click another
button and submit the form for processing. My idea is that I would then
parse this hidden field server side...

I have a WAMPHP based server and as a test, I dump out my entire $_POST
(basically, the name and value in every INPUT tag).

My PHP script picks up the name of every input tag, including the hidden
field (like it should) but for some reason, the value that was written
to the hidden field is not passed to the server. Thus, for the PHP folk
reading this post, my hidden input field is called mylist and
$_POST[''mylist''] exists, but its empty. Even though before processing,
I could visably see the input in the box (for debugging remember, I made
the input tag box a normal, unhidden one).

Here is what I have done to try and resolve:
- I have used both Mozilla 1.7.5 and IE6 - both provide same results -
my hidden field name gets passed, but not its value.

- I have created another hidden field and given it a default value ie I
have <input type="hidden" name="extraone" value="xyz"> and I get
$_POST[''extraone'']="xyz" passed to my php server, like I would expect -
however, the value of mylist is sent empty, even though it has data.

- I have even put in a javascript alert box just before the form is sent
to the server and can see the result in my (unhidden) box, and the same
value displayed in the javascript alert - but again, the value of the
mylist does not get sent to the server.
The only difference is that my hidden field (even if its displayed like
an ordinary text input box) does not post data written to form fields as
the result of a javascript function. Interestingly though, the server
does know about the input tag box since it does receive
$_POST[''mylist''], it justs receives it empty.

What gives? If the form reads my input from one field, and writes it to
another field, then it should be sent to the server, true?

Also... my tags are all inside my <form></form> tag (which is proven by
double checking, and the fact that I do get the input tag box name sent
to my server).

Since I can see the data values in the box, it tells me my javascript is
doing what it should be doing - so I don''t see any point in including my
javascript (though I have no problems doing so if someone requests
it). On the php server, I am using a simple phpinfo(); to check the
data is being received...

Has anybody got any ideas on this one? I''m tired racking my brains on
this one - I just might go to bed and try a fresh approach after a few
hours sleep...

Thanks in advance,
Randell D

推荐答案

_POST

(基本上,每个INPUT标签中的名称和值)。

我的PHP脚本选取每个输入标签的名称,包括隐藏的

字段(就像它应该的那样)但由于某种原因,写入隐藏字段的值不会传递给服务器。因此,对于阅读这篇文章的PHP民间

,我的隐藏输入字段称为mylist,
_POST
(basically, the name and value in every INPUT tag).

My PHP script picks up the name of every input tag, including the hidden
field (like it should) but for some reason, the value that was written
to the hidden field is not passed to the server. Thus, for the PHP folk
reading this post, my hidden input field is called mylist and


_POST [''mylist'']存在,但它是空的。即使在处理之前,

我可以在框中看到输入(为了调试记得,我把输入标签框设为

一个正常的,未隐藏的)。 />

以下是我尝试解决的问题:

- 我同时使用了Mozilla 1.7.5和IE6 - 两者都提供相同的结果 -

我的隐藏字段名称被传递,但不是它的值。


- 我创建了另一个隐藏字段并给它一个默认值即我

有< input type =" hidden"名称= QUOT; extraone"值= QUOT; XYZ">我得到
_POST[''mylist''] exists, but its empty. Even though before processing,
I could visably see the input in the box (for debugging remember, I made
the input tag box a normal, unhidden one).

Here is what I have done to try and resolve:
- I have used both Mozilla 1.7.5 and IE6 - both provide same results -
my hidden field name gets passed, but not its value.

- I have created another hidden field and given it a default value ie I
have <input type="hidden" name="extraone" value="xyz"> and I get


_POST [''extraone''] =" xyz"传递到我的php服务器,就像我期望的那样 -

然而,mylist的值被发送为空,即使它有数据。


- 我有甚至在表单发送之前放入一个javascript警告框

到服务器并且可以在我的(未隐藏)框中看到结果,并且显示相同的

值javascript警报 - 但同样,

mylist的值不会被发送到服务器。

唯一的区别是我的隐藏字段(即使它显示为

普通文本输入框)不会将写入表单字段的数据发布为

javascript函数的结果。有趣的是,服务器

确实知道输入标签盒,因为它确实收到了
_POST[''extraone'']="xyz" passed to my php server, like I would expect -
however, the value of mylist is sent empty, even though it has data.

- I have even put in a javascript alert box just before the form is sent
to the server and can see the result in my (unhidden) box, and the same
value displayed in the javascript alert - but again, the value of the
mylist does not get sent to the server.
The only difference is that my hidden field (even if its displayed like
an ordinary text input box) does not post data written to form fields as
the result of a javascript function. Interestingly though, the server
does know about the input tag box since it does receive


这篇关于奇怪的问题:来自隐藏字段的数据不会发送到服务器...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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