Eli PHP

In this assignment we were to watch a PHP Tutorial from Eli the Computer Guy. This tutorial consisted of an introduction to PHP, PHP Syntax and Errors, Comments and Include inb PHP, Variables in Print in PHP Programming, HTML forms and PHP Programming and Printing to files with PHP. Below are the assignment questions we were to answer.

PHP Programming Part 1 - Introduction to Programming

  1. How does Eli describe PHP?

    Eli describes PHP as the programming language that makes a website useful and allows the user to interact with data and write webpages.

  2. Briefly compare and contrast scripted and compiled languages.

    Compiled languages use software that when the code is written, it outputs and executable file. Scripted languages can be uploaded from a text file to a server where the user can access the file and the software will the n process the information and deliver it to the user.

  3. Briefly explain the difference between client side and server side scripting.

    With server side scripting, all the process is made at the web server and then output the HTML to the user. With client side, the user accesses the server but all the information gets sent to the users computer where all information to all users are.

  4. What popular website does Eli cite as an example of what you can do with PHP and MySQL? Why did Eli that that this particular site was a good example?

    Craigslist.com because it is powerful/effective but not pretty.

  5. What does Eli emphasize as the 'nice' thing about scripted languages such as PHP?

    You are always using the text file and you can always read the source file.

  6. What is notepad++? Why would Eli recommend notepad++?

    A text editor like notepad that contains a few additional features for writing code.

  7. If you want to write and run PHP code, what do you need?

    Notepad and a server that has PHP installed.

  8. How does Eli describe syntax?

    How you spell the commands you are using.

PHP Programming Part 2 - PHP Syntax and Errors

  1. In a Linux context, does capitalization matter?

    Yes.

  2. What are the basic attributes of PHP syntax?

    Open PHP with . Between the tags, create a command such as print and follow it with quotation marks around what you want outputted. Lastly, end the command with a semicolon.

  3. Discuss one of the PHP error handling techniques that Eli presents.

    Web browser will print out the error in the file and tell you which line (error may be on the line after or before).

  4. What is the difference between printing text and printing HTML?

    Web browser reads tags and html coding while PHP prints out text. Thus when working with formatting, use html tags in your php so the browser displays the correct formatting.

  5. What happens if you add a PHP script to a HTML page and you don’t change the file type to .php from .html?

    It does not matter from the servers perspective, it only matters from the users perspective.

PHP Programming Part 3 - Comments and INCLUDE in PHP Programming

  1. What are the three ways that you can make comments in PHP?

    Single line: // or #
    Multi line: /* */

  2. What is the PHP include function? Why is it useful?

    Grabs information form another file and includes it in the current file. This is useful because you don’t have to rewrite the information.

PHP Programming Part 4 - Variables in Print in PHP Programming

  1. What are the three types of PHP variables that Eli discusses?

    Strings, integers and arrays

  2. What naming rules apply to PHP variables?

    Must start with “$” and then with either a letter or underscore. Capitalization matters, PHP is case sensitive.

  3. Compare and contrast the html
    tag in HTML and the \n in PHP.


    When the end break tag is used, the break will be seen in the html web browser. When something is used, the break will only be seen in the text source code; not the html browser.

PHP Programming Part 5 - HTML Forms and PHP Programming

  1. What does it mean when Eli says that HTML creates static pages while PHP creates dynamic pages?

    HTML creates the form and all of its objects. If we are going to do anything with the form, we are going to pass it to PHP. PHP writes the information to file or takes information and does something with it.

  2. What naming rules apply to PHP variables?

    Must start with “$” and then with either a letter or underscore. Capitalization matters, PHP is case sensitive.

  3. In this exercise, you will use an HTML Textbox, an Option Box, and a Radio Button. What function does each of these input methods provide?
    tag in HTML and the \n in PHP.


    Textbox allows users to enter text strings up to the "size" attribute, Option boxes allow a user to select from a predefined list. If setup correctly the user can utilize the CTRL key to select multiple choices. Radio buttons allow a user to select one choice from a predefined list. The label attribute can be used to make selection more user friendly by allowing the text to be clicked to activate the selection.

PHP Programming Part 6 - Printing to Files with PHP

  1. In this example, you use the PHP file_put_contents() function. Briefly describe this function.
    Hint: Consult W3Schools or the PHP manual.


    This function writes the information, that was given, to a file.

  2. What is a CSV file? Why would you want to use one?

    Comma separated value file is a spreadsheet format. Can be opened with any spreadsheet program and then be saved as an excel file to be emailed.

My Pic