3: Scripting Language
- Page ID
- 3308
\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)
Learning Objectives
By the end of this section, you should be able to demonstrate:
- An ability to create PHP scripts
- An ability to receive, store, and manipulate user data
- An ability to interact with files
- The ability to create and send basic email
- The ability to use logic and control structures in scripts
- The ability to create functions and simple classes
- Altering a page using JavaScript and jQuery
- 3.1: Server-Side and Client-Side Scripting
- For web development, there are normally two kinds of scripting languages are used: server-side scripting and client-side scripting.
- 3.2: Creating PHP Files
- In order to start a PHP project, you have to create the file first. You can either put it together with HTMLs, or set it up in a new file.
- 3.3: PHP Errors
- Before starting, an understanding of errors will help you quickly recognize where problems exist (and if they are truly problems) in your code, which will lend to faster debugging and understanding where to look for problems.
- 3.4: PHP Output
- It is critical to receive output from PHP programs. In this chapter, we will introduce some of the basic and important mechanisms which allow you to receive outputs from the program.
- 3.5: Data Storage
- To make a program useful, you need something more than simply output characters. Data storages are another critical element of a successful PHP program which allows you to output something meaningful.
- 3.6: Data Manipulation
- After the data is received and stored, it is necessary to manipulate it in ways such as calculation. In this chapter, we will learn some of the ways such as operators.
- 3.7: Email
- One of the function PHP can do is sending e-mail through a built-in sendmail function. Many email-related functions such as recovering password can be accomplished through this method.
- 3.8: File Interaction
- We can use PHP to create and read files in a variety of formats, allowing us to create whole new pages, store information in document form, copy files, and plenty more. The first step in this process is creating a new file, or opening an existing file, that we want to work with. To do this, we use the function fopen() to declare the file’s location and how we intend to interact with its contents.
- 3.9: Structures
- Referred to as selection, control, or loop structures, this set of elements dictate conditions under which certain sections code are executed. They allow our program to be flexible, instead of restricting it to the same actions every iteration. Here, we will consider all of them together, as structures in general.
- 3.10: Functions
- In any language we use, there are concepts that are not always translatable from one to the next, if the concept is even present in both. In programming languages, we can find a parallel to this when functions or abilities in one language are not available in another, or require additional code to achieve.
- 3.11: JavaScript Syntax
- Although JavaScripts and PHP shares numbers of common syntaxes, there are still a lot of difference between these two languages. Sometimes, JavaScripts can achieve jobs with less coding work than PHP.
- 3.12: JavaScript Examples
- In this chapter, we will introduce some interactions between the website and visitors with JavaScript such as events and geolocations.
- 3.13: jQuery
- jQuery is a freely available library add-on to JavaScript. It reduces the amount of code and complexity required to produce features and effects commonly used in creating today’s sites.
- 3.E: Scripting Language (Exercises)
- Activities and questions