0

I am trying to get the values of the HTML fields onto php and I can only see a few coming through using a print_r ($_REQUEST) .

So with the current html (http://pastebin.com/SDjZQCxD) i can't get anything through that is inside the div userData.

If I move the contents of that div above input id="submit-addItem" type="button" value="Add my item" style="display: block; display: none;" /> then strangely enough I can see the values in php using the get ..(so it works)

However I am puzzled in regards to why .. I mean I want to leave the elements as it and they are all inside the form so I am not sure why if I move them above the submit-additem it works but otherwise it doesn't..

The html code can be found here http://pastebin.com/SDjZQCxD

Thanks

Athanatos
  • 1,089
  • 6
  • 15
  • 32

3 Answers3

1

Strange things occurs when you have multiple nested form tags.

I will suggest to remove the <form name="aaa2"> tag and try it, that why. I don't see any usage for that second form.

Garis M Suero
  • 7,974
  • 7
  • 45
  • 68
1

Well one of the main issues I think is that you have a form nested in another form. You shouldn't do that.

Another reason is that I believe that the = character in your inputs is restricted. That might cause some weird issues for you.

<input class="styleA" id="item-location=ad1" name="item-location=ad1" type="text" value="Address Line 1" />

ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods (".")

Community
  • 1
  • 1
Ryan George
  • 186
  • 9
0

If a form field is not rendered because of a CSS style (in this case, display: none;), it will typically not be submitted via. post. (I say "typically" because the language in the W3 spec says that these hidden controls "may" be successful, but my experience is that most browsers will ignore them as if they were disabled).

Instead of display: none;, try using visibility: hidden; and position: absolute;. You'll get the same visual effect, but the hidden form controls will be submitted.

Liv
  • 260
  • 1
  • 4