PHP versus CGI
Alex Rice
alex at mindlube.com
Tue Feb 17 17:26:26 EST 2004
On Feb 17, 2004, at 4:32 PM, Alain Farmer wrote:
> With PHP, all the web-form's elements are
> automatically assigned to variables, with variable
> names with the same name as the corresponding
> form-item, such that you can use them immediately in
> your script without any hassle whatsoever.
Unfortunately PHP now has that feature turned off in the default
distribution. Although most ISPs probably turn it on again when
installing PHP. For maximum PHP portability you must code things like
$HTTP_GET_VARS['myvar'] and $HTTP_POST_VARS['othervar'] instead of
$myvar and $othervar
But I agree with your general point: PHP was written with web
application programming in mind, so it's easy to "hit the ground
running" when writing web apps with PHP.
> With CGI, you have to handle the appleEvent (on a
> Mac), you have to parse the request, fetch the
> information of the form, decode the special chars,
> etc. Then, and only then, can you USE the info
> submitted in/to your script. That's a lot of extra
> work, particularly if you're also using any of the
> environment-variables of HTTP.
Of course that depends if you are using a CGI code library or not. In
Perl it could be as easy as:
use CGI;
$query = new CGI;
$fieldValue = $query->{'fieldName'};
or something like that.
However, I've never used libCGI for MC so 'scuse me for butting in :-)
--
Alex Rice | Mindlube Software | http://mindlube.com
More information about the metacard
mailing list