> One can use either php or javascript for numerous functions, including forms. > Is one better than the other? > Is cgi better, or more secure, than either? > > This is slightly off-topic but I hope this will be allowed, and maybe of > interest to others: > javascript is very popular, often incorporated into 3rd. party software like > web stats, and email subscriptions and newsletters. But it can also be > disabled. So what is the point of using software that can be disabled, and > why do users disable it? > > Jane Trimmer > Web developer
In part you have answered your own question. Web browsers disable Javascript because it is the main mechanism to launch annoying pop-up and pop-under ads. It can be something of a security risk but not nearly as much as ActiveX and some Java applets. When it comes to receiving data from the user, you should never trust it without some form of validation to make sure that the values are in the range you are expecting. Failure to do so can lead to nasty surprises. When you refer to CGI, I assume you mean Perl, though the Common Gateway Interface is a communication standard between web forms and server programs. These programs could be written in Perl, C, Bash, or PHP (among others). If you are referring to Perl, I would say that I prefer to do most of my work in PHP. The code is easier to read and less subject to obfuscation as Perl is. Some Perl programmers take pride in the one-liner which is so compact that another Perl user may have difficulty finding out what is being accomplished. The PHP function names generally describe fairly well what they are trying to accomplish. This makes to code easier to read and maintain. PHP programs are easily embedded in HTML documents. With most Perl methods I have seen you have to use functions or print statements to output all of the HTML. This makes things more challenging when the page crosses a certain complexity threshhold. Finally, CGI programs of all types, including Perl, require certain permissions, ownership, and locations which can be harder to work with than the usual PHP installation. In servers where PHP is an Apache module, you generally can give the PHP pages the same permissions as any other web page or image file (readable by the web server user) and put it in the same directory structure as the web pages and they work. Perl/CGI programs need to be in special directories for the most part and the ownership, permissions, and location are governed by a number of security modules, including suExec. Ultimately, "better" is a matter of preference. These are the reasons I prefer PHP over Perl. I use Javascript when it can do a job PHP can't. I don't use it as sole validation of forms because it is not reliably turned on for all web browsers. James _____ James D. Keeline http://www.Keeline.com http://www.Keeline.com/articles http://Stratemeyer.org http://www.Keeline.com/TSCollection http://www.ITeachPHP.com -- Free Computer Classes: Linux, PHP, etc. Fall Semester Begins Sep 7 -- New Classes Start Every Few Weeks. ------------------------ Yahoo! Groups Sponsor --------------------~--> Most low income households are not online. Help bridge the digital divide today! http://us.click.yahoo.com/cd_AJB/QnQLAA/TtwFAA/HKFolB/TM --------------------------------------------------------------------~-> Community email addresses: Post message: [email protected] Subscribe: [EMAIL PROTECTED] Unsubscribe: [EMAIL PROTECTED] List owner: [EMAIL PROTECTED] Shortcut URL to this page: http://groups.yahoo.com/group/php-list Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/php-list/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
