>http://www-4.ibm.com/software/developer/library/script-survey/>> while it's focusing on cgi a lot is applicable to everyday stuff. note
> at the bottom that there are some links to other scripting tutorials
> including two on bash.
>
Very interesting, although he obviously hasn't looked into PHP very heavily...
<QUOTE>
Task 2: Put form field data into variables
PHP and Java servlets let you skip the first step and jump right to assignment,
as long as you get the variable names you expect. For more generic processing,
you would iterate through the list of received variables and assign them
dynamically.
$data = $HTTP_POST_VARS["data"];
$data2 = $HTTP_POST_VARS["data2"];
</QUOTE>
Eaaagh! Wrong! PHP lets you skip all steps - all GET, POST and ENV variables are
imported to the symbol table automatically at runtime. So if you pass a variable
via GET in a URL <http://www.dom.com/script.php3?var1=val1>, 'val1' is
immediately available in $var1. Same goes for environment variables -
$HTTP_HOST, $REQUEST_URI, etc. It's one of the best things about PHP.
</QUOTE>
Task 6: Split comma-delimited line into variables
list( $a,$b,$c,$d ) = split( ",", $last, 4 );
</QUOTE>
In this case, he's right, but he's wasting resources - explode() would be a
better function to use here, because it splits on a plain-jane string. split(),
however, splits on a regex, meaning it has to load up the regular expression
engine.
It's all in the manual. RTFM Mr. McElwee. :)
adam
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!