Arrays and HTML

Arrays are great because they’re used to hold lists of data in your programming
language. Of course, HTML already has other ways of working with
lists. The <ul> and <ol> tags are both used for visual representations of
lists, and the <select> object is used to let the user choose from a list. It’s
very common to build these HTML structures from arrays.

Learning the MySQL Data Types

MySQL uses many different data types, broken into three categories: numeric, date and time, and string types.

 INT—A normal-sized integer that can be signed or unsigned. If signed, the
allowable range is from –2147483648 to 2147483647. If unsigned, the allowable
range is from 0 to 4294967295. You can specify a width of up to 11 digits.

. TINYINT—A small integer that can be signed or unsigned. If signed, the allowable
range is from –128 to 127. If unsigned, the allowable range is from 0 to
255. You can specify a width of up to 4 digits.

 SMALLINT—A small integer that can be signed or unsigned. If signed, the
allowable range is from –32768 to 32767. If unsigned, the allowable range is
from 0 to 65535. You can specify a width of up to 5 digits.

 MEDIUMINT—A medium-sized integer that can be signed or unsigned. If signed,
the allowable range is from –8388608 to 8388607. If unsigned, the allowable
range is from 0 to 16777215. You can specify a width of up to 9 digits.

 BIGINT—A large integer that can be signed or unsigned. If signed, the allowable
range is from –9223372036854775808 to 9223372036854775807. If
unsigned, the allowable range is from 0 to 18446744073709551615. You can
specify a width of up to 11 digits.

FLOAT(M,D)—A floating-point number that cannot be unsigned. You can
define the display length (M) and the number of decimals (D). This is not
required and defaults to 10,2, where 2 is the number of decimals and 10 is the
total number of digits (including decimals). Decimal precision can go to 24
places for a FLOAT.

 DOUBLE(M,D)—A double-precision floating-point number that cannot be
unsigned. You can define the display length (M) and the number of decimals
(D). This is not required and will default to 16,4, where 4 is the number of
decimals. Decimal precision can go to 53 places for a DOUBLE. REAL is a synonym
for DOUBLE.


DECIMAL(M,D)—An unpacked floating-point number that cannot be unsigned.
In unpacked decimals, each decimal corresponds to 1 byte. Defining the display
length (M) and the number of decimals (D) is required. NUMERIC is a synonym
for DECIMAL.

$_GET , $_POST,$_COOKIE??

$_GET contains any variables provided to a script through the GET method.
 $_POST contains any variables provided to a script through the POST method.
 $_COOKIE contains any variables provided to a script through a cookie.

What line should you add to the Apache configuration file to ensure that the .php extension is recognized?

This line ensures that Apache will treat files ending with the .php extension as
PHP scripts:
AddType application/x-httpd-php .php

php.ini Basics

After you have compiled or installed PHP, you can still change its behavior
with the php.ini file. On Linux/UNIX systems, the default location for this file is
/usr/local/php/lib or the lib subdirectory of the PHP installation location you
used at configuration time. On a Windows system, this file should be in the PHP
directory or another directory as specified by the value of PHPIniDir in the Apache

What Is a Function?

You can think of a function as an input/output machine. This machine takes the raw
materials you feed it (input) and works with them to produce a product (output). A function
accepts values, processes them, and then performs an action (printing to the browser,
for example), returns a new value, or both.

How do you convert the while statement you created in question 3 into a for statement?

$num = 1;
while ($num <= 49) {
echo $num.”<br />”;
$num += 2;
}

JavaScript Form Validation

 JavaScript Form Validation. JavaScript can be used to validate data in HTML forms


<script type="text/javascript">
function validate_all()
    {
    var frmReg=document.manageadmin;
  
  
  
    if(frmReg.name.value.search(/\S/) == -1)
        {
            alert("Please enter name.");
            frmReg.name.focus();
            return false;
        }
  
  
    if(frmReg.textEmail.value.search(/\S/) == -1)
        {
            alert("Please enter Email.");
            frmReg.textEmail.focus();
            return false;
        }
  

Embedding Content for Plug-Ins

Although never officially a part of any HTML specification, the <<embed>> tag is most often used to include embedded objects for Netscape and Internet Explorer. A Macromedia Flash file might be embedded as follows:
 
 
<<embed id="demo" name="demo"
 src="http://www.javascriptref.com/examples/ch18/flash.swf"
 width="318" height="252" play="true" loop="false"
 pluginspage="http://www.macromedia.com/go/getflashplayer"
 swliveconnect="true">><</embed>>
 
The most important attributes of the <<embed>> tag are src, which gives the URL of the embedded object, and pluginspage, which indicates to the browser where the required plug-in is to be found if it is not installed in the browser. Plug-in vendors typically make available the embedding syntax, so check their site for the value of pluginspage.
Recall that applets embedded with <<object>> tags are passed initial parameters in <<param>> tags. The syntax of <<embed>> is different in that initial parameters are passed using attributes of the element itself. For instance, in the preceding example the play attribute tells the plug-in to immediately begin playing the specified file.
The <<object>> element is the newer, official way to include embedded objects of any kind in your pages. However, <<object>> is not supported in Netscape browsers prior to version 4, and <<embed>> continues to be supported by new browsers. So it is unlikely that <<object>> will completely supplant <<embed>> any time in the near future.
 

Remote JavaScript

The primary reason is that the round trip time required to submit a form and then download the response is often inconvenient. The user experience is much improved if, instead of clicking a Submit button and watching the screen go blank and then be replaced by the response of a server-side program, a user can click a button and have the page be updated without a visible form submission. To the user, the page would behave more like an application than a Web page. 

There are other advantages as well. If communication with a server can be done behind the scenes instead of using form submissions or clicking on links, the developer can carry out more complicated tasks requiring multiple server requests at once. The ability to use remote JavaScript also means that tasks that previously required an ActiveX object or Java applet can be implemented with script. This is a tremendous timesaver for the developer and also reduces the complexity of debugging significantly. 

The abstraction that remote JavaScript brings to life is the remote procedure call. A remote procedure call (RPC) is a function that executes on a remote machine, in this case a Web server. The client, in this case our browser using JavaScript, passes arguments to the “function” it wishes to call via an HTTP request; the server executes the specified function, often implemented as a CGI program or server-side script in PHP or a similar language, and returns the results as the body of the HTTP response. It’s important to remember that while JavaScript is used to make the function call and often to handle the return value, the function itself executes on the server, and therefore can be implemented as a CGI, PHP script, Java servlet, or using any other technology a Web server might have available.