PHP Classes

POST: Javascript Arrays

Recommend this page to a friend!

      PHP HTTP protocol client  >  All threads  >  POST: Javascript Arrays  >  (Un) Subscribe thread alerts  
Subject:POST: Javascript Arrays
Summary:Having a hard time trying to reproduce a JS array-post
Messages:2
Author:Erik Range
Date:2007-02-12 14:30:37
Update:2007-02-15 21:42:08
 

  1. POST: Javascript Arrays   Reply   Report abuse  
Picture of Erik Range Erik Range - 2007-02-12 14:30:37
First and foremost, your class simply rocks, so to say. At the first glance I was a bit confused about the errorhandling, but after one gets used to the main methods, this class is a real jewel. Thanks for all the time you spent developing it.

I usually don't ask any questions in boards and try to figure out everything myself, but this problem has given me a real hard time. I try to reproduce a form, in which some <input>-names are defined as JS-arrays, i.e.

<input name="foo[bar]" value="something" />
<input name="foo[foo]" value="anything" />
<input name="foo[manshu]" value="swampthing" />

Now my PHP-part would look like this:

[...]
$PostValues = array(
"foo[bar]" => "something",
"foo[foo]" => "anything",
"foo[manshu]" => "swampthing"
);
[...]

Which doesn't quite work out.. and I tried about everything, searched Google hi and low, and I don't even get a clue about how to solve this. I tried a capsulated array like

$PostValues = array( foo => array( "bar" => "something", "foo" => "anything", "manshu" => "swampthing" ) );

but that doesn't work either. So if you got any hint or any idea, that'd be awesome.

Thanks in advance, even if you don't. ;-)

- Gronkh

  2. Re: POST: Javascript Arrays   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2007-02-15 21:42:08 - In reply to message 1 from Erik Range
The PostValues array supports entries defined with array values. However those are used to submit forms with multiple fields with the same name.

The class supports submitting forms with input names with brackets or other unusual characters. However, there was a bug that was not encoding the input values correctly. Despite it would still work with sites using PHP, it may not work with the site you are trying.

I have just uploaded the fixed version. Just let me know if it works for you now.