What you want to do really screams for a templating engine,
as the only thing that changes per document is the data
from the web form.
Personally, I wouldn't create the images with GD but create PDFs
from LaTeX, as LaTeX gives a lot of flexibility and a nice
layout. The sooner you go away from overlaying text
onto a pretty picture, the easier it will be.
The only problem is, of course, if the pretty background picture
is something you cannot change/influence. Then, TeX is out of the window,
as you'd then have to describe the fields as locations to TeX,
which is no more fun than describing them to GD.
Have a look at TT2, which is, AFAIK, a general templating system
(opposed to a templating system geared for HTML) and what TeX
output you can get from there. The rest, spawning off
LaTeX to create a temporary PDF and redirecting the
user to that PDF file is then fairly simple.
perl -MHTTP::Daemon -MHTTP::Response -MLWP::Simple -e ' ; # The
$d = new HTTP::Daemon and fork and getprint $d->url and exit;#spider
($c = $d->accept())->get_request(); $c->send_response( new #in the
HTTP::Response(200,$_,$_,qq(Just another Perl hacker\n))); ' # web