
This kind of lazy form creation really annoys me. This company is trying to make users jump through hoops just so their form developers don’t have to bother reformatting the data into an acceptable format to them.
Sep 1 2009

This kind of lazy form creation really annoys me. This company is trying to make users jump through hoops just so their form developers don’t have to bother reformatting the data into an acceptable format to them.
Aug 27 2009
Argh, it really annoys me when web designers have check boxes or radio buttons that do not have clickable text attached. If you’re writing your website correctly (semantics-wise at least) then you shouldn’t have this problem because you’ll be making use of <label for=”…”>. It’s really not hard, and it’s such a simple solution for a big (well, medium) usability issue. Note that the value of the for=”…” attribute must match the id=”…” attribue of the element it is meant to label, not the name=”…” attribute as some people think…
Consider making:
<input type="checkbox" name="remember_me" /> Remember my loginInto:
<input type="checkbox" name="remember_me" id="remember_me" /> <label for="remember_me">Remember my login</label>
kthxbai.
Feb 6 2009
Here’s something I don’t do very often, but I’ve written a quick procedural script that could easily be turned into a class that will submit data to a HTTP POST “webservice”. It wouldn’t be a web service per se, rather than just a PHP script that accepts POST parameters, as opposed to an actual SOAP endpoint.
<?php // Put the URL of your "POST endpoint" $url = 'http://some/script/that/accepts/POST/input.php'; // Add your field pairs to this array... $field_pairs = array( array("field1", "avalue"), array("field2", "bvalue"), ); // This bit prepares the fields by imploding them into a format similar to a query string... $fields = array(); foreach($field_pairs as $field_pair) { $fields[] = implode("=", $field_pair); } $postfields = implode("&", $fields); // This sends the request through cURL $c = curl_init(); curl_setopt($c, CURLOPT_URL, $url); curl_setopt($c, CURLOPT_POST, true); curl_setopt($c, CURLOPT_POSTFIELDS, $postfields); curl_exec($c); curl_close($c); ?>
Feb 6 2009
Someone puts in your form “William”, that’s great. But what about “Willliam”? That needs to fail validation. There’s been some cases here at Netbasic where people put “UUUUUU” or “AAAAAA” as their names, obviously fake names. It seems a simple enough task, but I did have a bit of trouble finding a good regexp to check for repetative characters. I’m not always the best with regular expressions, so this is what I found:
$result = preg_match('/([a-z])\1{3,}/', $value);
That works!
Feb 5 2009
Danish blogger Troels Knak-Nielsen wrote an interesting article about the PHP superglobals $_GET and $_POST today, bemoaning the fact they’re not technically named correctly. Reading through it, he makes a good point:
The current names are confusing and obscures the intention of HTTP; More descriptive names would have been
$_QUERYinstead of$_GETand$_FORMinstead of$_POST
What’s he’s saying in a nutshell that if you send an HTTP POST request, such as:
POST /submit.php?param=HelloWorld HTTP/1.1 Host: asgrim.com Content-Length: 29 name=James&url=www.asgrim.com
Then $_POST["name"] is “James”, $_POST["url"] is “www.asgrim.com”, but despite the form being submitted as POST, $_GET["param"] is HelloWorld. Technically, yes – he’s right. Logically, because name and url are part of the form data, the variables should be called $_FORM["name"], $_FORM["url"] and $_QUERY["param"].
He also makes the point that it might not be that big a disruption to change, sporting the introduction of superglobals instead of $_GET and $_POST as a replacement for register_globals as an example.
However, as one commenter, Rory, points out:
I can see what you’re getting at with
$_QUERYand$_FORMbut if you define your form as<form method="get">your form data will be in$_QUERYnot$_FORMwhich is possibly just as confusing for those who don’t understand the difference. I suspect the method attribute on forms is where$_GETand$_POSTcame from.
And my opinion? Well I can see what Troels is saying, and it’s a good valid point… I might have a little bit of cainophobia, but I’m happy with the way things are, and I’ll use Rory’s argument to back me up.