Home
Username:
Password:
FileMaker 9 & PHP Foundations Tutorials

PHP Basics / Code Basics pt. 2

Subtitles of the Movie

Now let's continue on with the lesson. I'm going to go ahead and write an actual PHP statement. I'm going to use the echo command, which passes a string back to the PHP processor and then the web server for output to the browser. Strings in PHP, just like in the FileMaker calculation engine, have to be enclosed in quotes. I'm going to output another line after that. And then output it to the browser too. And let's see the results that we get. I can tell you right now the results are going to be an error, but I'm doing that on purpose because I want to make a very strong point. The reason why PHP says there's an error is because I did not terminate my statements or tell the PHP engine when each one of these statements ended. You have to terminate each statement in PHP with a semicolon. This right here is now a complete PHP statement and it knows it ends here at the semicolon. I'll do the same with the second statement. What I'm doing is I'm telling PHP to output this text to the web browser and then to output this text to the web browser. Let's refresh it now. Here's the output just as I expected it to be. I can see it a little bit clearly and when I view the source code. I want to point out something very important here. Notice that none of the PHP code is actually revealed inside the source code for the web page. The only thing that's outputted to the web browser is the results of the PHP processing, not the code that was processed. This is a nice security block with PHP because you can have a lot of PHP logic, including IP addresses of servers, user names and passwords to access databases and so forth that will never be accessible or viewable inside the browser. Another thing to notice here too is that PHP completely ignored the returns after these two statements. PHP is a pretty flexible language. It will ignore white spaces and returns so that you can organize your code in a way that's pleasing to you, the programmer. I'll save this and refresh it. Notice that there's no line returns at all. I could put line returns in here using the new line character, and then output that to the browser. It's not viewable in the web browser, but it is when I look at the source code. Here's the return sign. The reason why I don't see it in my HTML because with HTML, it doesn't honor or recognize return characters either. You have to use the break tag. So remember with PHP you must have valid statements and the statements must be terminated by a semicolon. PHP will ignore white spaces and return characters and you can place PHP code multiple times anywhere inside your HTML document. The last thing I want to mention to you is another PHP statement. There's a function in PHP called PHP info, which will grab all the pertinent information and configuration information about the PHP engine that's running. In order to get this information to the browser, I'll use the echo statement before PHP info. Since PHP info is a function, we'll need to place the open and closing parentheses afterwards, just like you would with a custom function in FileMaker Pro. When I refresh my browser, PHP outputted a nice table, which shows all the configuration information for this particular installation of PHP. This can be very handy when you have an outside hosting company or somebody else is in charge of your web server and you're not familiar or you're not aware of the type or version of PHP that's installed. Going through this table will inform you of the many different libraries or modules that are currently configured and running with the PHP installation. This concludes our introduction and basics of PHP programming.

Tutorial Information

Course: FileMaker 9 & PHP Foundations
Author: Lance Hallberg
SKU: 33786
ISBN: 1-933736-99-2
Release Date: 2007-08-22
Duration: 9.5 hrs / 107 lessons
Work Files: Yes
Captions: For Online University members only
Compatibility: Vista/XP/2000, OS X, Linux
QuickTime 7, Flash 8

VTC Sign up & Benefits

  • Unlimited Access
  • 81,350 Video Tutorials (20,800 free)
  • Video Available as Flash or QuickTime
  • Over 782 Courses
  • $30 for One Month Access
  • Multi-User Discounts Available