an eddy in the bitstream

Month: July 2009 (Page 1 of 2)

POST with multiple values per key

Dumb. And bad.

PHP requires that you change your HTML to indicate that an input value in a form expects multiple values. That means, your HTML needs to know what your server-side architecture is coded in.

Dumb. And bad.

Example:

 <input name="foo" value="123" />
 <input name="foo" value="456" />

That code above won’t work in a POST to a .php script because one of the values for ‘foo’ will be dropped. Instead, you have to code your html like:

 
 <input name="foo[]" value="123" />
 <input name="foo[]" value="456" />

with that extra little [] bracket pair. That’s just Wrong. And bad. My HTML shouldn’t care what the server side language is. HTTP is HTTP. HTML is HTML. It’s agnostic. Unless your scripting language is broken. Like PHP is.

« Older posts

© 2024 peknet

Theme by Anders NorenUp ↑