[nycphp-talk] newbie - square one
Brian Pang
bpang at bpang.com
Tue Dec 2 09:52:59 EST 2003
I'm going to skip straight to the php.
With this code, you are initializing $params as a variable with value.
> <?php
> $params=value;
> ...
> ?>
However you are passing ?params=value in the query string. You can
access the query string variable directly as $_GET['params'].
> and that the query string will have "created" the variable $params
> and somehow PHP will "know" what's in the query string and
> "value" will be defined...really? I don't have to extract some
> ENV-VAR like old-fashioned CGI processing?
This only happens if register_globals is turned on in your php_ini.
Don't rely on it. Do it the right way with $_GET['params'].
Change this:
> <?php
> $params=value;
> echo "<BODY onLoad=\"myJavaScriptFunc(\" + $params + \");\" ";
> ?>
to:
<BODY onload="myJavaScriptFunc(<?=$_GET['params']?>)">
It's MUCH easier to drop PHP vars into html this way, rather than
echoing out the full line with escaped quotes, etc.
More information about the talk
mailing list
Automatic Email Organization without missing anything!