peknet :: an eddy in the bit stream         
about peknet
peknet is Peter E Karman musing on technology, politics, religion, books, beer and parenthood.

navigate

credits

Brighter Planet's 350 Challenge

St Paul Minnesota Yellow Pages

Powered by Swish-e

Valid CSS!

proud member of the
Open Source Community

© 2005 peknet dot com

syndicate this site

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.

File under projects/php Wed Jul 15 16:56:58 CT 2009


Past entries: 2004 . 2005 . 2006 . 2007 . 2008 . 2009 . 2010 . 2011 . 2012 .