20 5 / 2011
reCaptcha and table based layouts
What based layouts? Table based layouts. I’ve been doing a small job making some modifications to a very old system that uses table layouts and non object oriented PHP. Frankly it’s a mess, and table layouts don’t just make it difficult to make layout changes. They were also the source of a problem installing reCaptcha that had me stumped for well over 2 hours!
Basically, if you have a structure like this:
<table>
<form>
<?php
require_once('../class/recaptchalib.php');
echo recaptcha_get_html($publickey);
?>
</form>
</table>
It simply wont POST the necessary fields “recaptcha_challenge_field” and “recaptcha_response_field”. I don’t know why, all I know is that they’re called from a function in the reCaptcha library and this is how to solve it:
<form>
<table>
<?php
require_once('../class/recaptchalib.php');
echo recaptcha_get_html($publickey);
?>
</table>
</form>
Make sure the form tags are wrapping the table tags. I’d love for someone to tell me why this is, but for now I’ll have to settle with just knowing that it works.
Permalink 4 notes