Selamat Datang Di Blog Aldot :)

Blog ini berisikan seputar tentang kehidupan saya,pengalaman saya,pengetahuan saya dan beberapa artikel yang saya ketahui. Terimakasih telah mengunjungi blog saya.

Selamat Datang Di Blog Aldot :)

Blog ini berisikan seputar tentang kehidupan saya,pengalaman saya,pengetahuan saya dan beberapa artikel yang saya ketahui. Terimakasih telah mengunjungi blog saya.

Selamat Datang Di Blog Aldot :)

Blog ini berisikan seputar tentang kehidupan saya,pengalaman saya,pengetahuan saya dan beberapa artikel yang saya ketahui. Terimakasih telah mengunjungi blog saya.

Selamat Datang Di Blog Aldot :)

Blog ini berisikan seputar tentang kehidupan saya,pengalaman saya,pengetahuan saya dan beberapa artikel yang saya ketahui. Terimakasih telah mengunjungi blog saya.

Selamat Datang Di Blog Aldot :)

Blog ini berisikan seputar tentang kehidupan saya,pengalaman saya,pengetahuan saya dan beberapa artikel yang saya ketahui. Terimakasih telah mengunjungi blog saya.

Wednesday, October 26, 2011

PHP If...Else Statements

Conditional statements are used to perform different actions based on different conditions. Conditional StatementsVery often when you write code, you want to perform different actions for different decisions. You can use conditional statements in your code to do this. In PHP we have the following conditional statements: if statement - use this statement to execute some code only if a specified condition is true if...else statement - use this statement to execute some code if a condition is true and another code if the condition is false if...elseif....else statement - use this statement to select one of several blocks of code to be executed switch statement - use this statement to select one of many blocks of code to be executed The if StatementUse the if statement to execute some...

PHP Operators

This section lists the different operators used in PHP. Operator Description Example Result + Addition x=2 x+2 4 - Subtraction x=2 5-x 3 * Multiplication x=4 x*5 20 / Division 15/5 5/2 3 2.5 % Modulus (division remainder) 5%2 10%8 10%2 1 2 0 ++ Increment x=5 x++ x=6 -- Decrement x=5 x-- x=4 Assignment Operators Operator Example Is The Same As = x=y x=y += x+=y x=x+y -= x-=y x=x-y *= x*=y x=x*y /= x/=y x=x/y .= x.=y x=x.y %= x%=y x=x%y Comparison Operators Operator Description Example == is equal to 5==8 returns false != is not equal 5!=8 returns true <> is not equal 5<>8 returns true > is greater than 5>8 returns false < is less than 5<8 returns true >= is greater than or equal to 5>=8 returns false...

PHP String Variables

String Variables in PHPString variables are used for values that contain characters. In this chapter we are going to look at the most common functions and operators used to manipulate strings in PHP. After we create a string we can manipulate it. A string can be used directly in a function or it can be stored in a variable. Below, the PHP script assigns the text "Hello World" to a string variable called $txt: <?php $txt="Hello World"; echo $txt; ?>  The output of the code above will be: Hello World Now, lets try to use some different functions and operators to manipulate the string. The Concatenation OperatorThere is only one string operator in PHP. The concatenation operator (.)  is used to put two string values together. To concatenate two string variables...

PHP Variables

Variables in PHPVariables are used for storing values, like text strings, numbers or arrays. When a variable is declared, it can be used over and over again in your script. All variables in PHP start with a $ sign symbol. The correct way of declaring a variable in PHP: $var_name = value;  New PHP programmers often forget the $ sign at the beginning of the variable. In that case it will not work. Let's try creating a variable containing a string, and a variable containing a number: <?php $txt="Hello World!"; $x=16; ?> PHP is a Loosely Typed LanguageIn PHP, a variable does not need to be declared before adding a value to it. In the example above, you see that you do not have to tell PHP which data type the variable is. PHP automatically converts the variable to...

PHP Syntax

Basic PHP SyntaxA PHP scripting block always starts with <?php and ends with ?>. A PHP scripting block can be placed anywhere in the document. On servers with shorthand support enabled you can start a scripting block with <? and end with ?>. For maximum compatibility, we recommend that you use the standard form (<?php) rather than the shorthand form. <?php ?> A PHP file normally contains HTML tags, just like an HTML file, and some PHP scripting code. Below, we have an example of a simple PHP script which sends the text "Hello World" to the browser: <html> <body> <?php echo "Hello World"; ?> </body> </html>  Each code line in PHP must end with a semicolon. The semicolon is a separator and is used to distinguish one set...

Use parenthesis in expression 2

<html> <head> <title>A Simple Page</title> <script language="JavaScript"> <!-- function calcArea() {     inpRadius = 3;     document.write(Math.PI * ((inpRadius)*(inpRadius))); } function calcPeri() {     inpRadius = 3;     document.write(2 * Math.PI * (inpRadius)); } function calcVol() {     inpRadius = 3;     document.write(Math.PI * ((inpRadius)*(inpRadius)*(inpRadius)) * (4/3)); } //  --> </script> </head> <body> <h1>All about Circles and Spheres!</h1> <P>Click <input type="button" value="HERE" onclick="calcArea();"> to calculate circle area!</p> <br> <P>Click <input type="button" value="HERE" onclick="calcPeri();"> to calculate circle perimeter!</p> <br> <P>Click <input type="button" value="HERE" onclick="calcVol();"> to calculate sphere volume!</p> </body> </html> References...

Use parenthesis in expression

<html> <head> <title>A Simple Page</title> <script language="JavaScript"> <!--     var inpRadius;     inpRadius = 3;     document.write(Math.PI * ((inpRadius)*(inpRadius))); //  --> </script> </head> <body> </body> </html> References from  http://www.java2s.com/Tutorial/JavaScript...

Hide scripts using comments

<html> <head> <title>Hide scripts using comments.</title> <script language="javascript" type="text/javascript"> <!-- lines of JavaScript code here ... //--> </script> </head> <body> Page content here... </body> </html> References from  http://www.java2s.com/Tutorial/JavaScript...

Multiline comments

/* */ enables comments to span multiple lines. Example <html> <head> <title>A Simple Page</title> <script language="javascript"> <!-- /* Below two alert() methods are used to fire up two message boxes - note how the second one fires after the OK button on the first has been clicked */ alert("An alert triggered by JavaScript!"); alert("A second message appears!"); //  --> </script> </head> <body> </body> </html> References from  http://www.java2s.com/Tutorial/JavaScript...

Single line comments

The // comment tag enables comments to be placed between the // and the end of the line. Example : <html> <head> <title>A Simple Page</title> <script language="javascript"> <!-- // The first alert is below alert("An alert triggered by JavaScript!"); // Here is the second alert alert("A second message appears!"); //  --> </script> </head> <body> </body> </html> References from  http://www.java2s.com/Tutorial/JavaScrip...

HTML - Horizontal Rule

Use <hr/> to create a horizontal line. THis tag is similar with line break. <hr/> Use <hr/><hr/> With <hr/> Caution <hr/> Display Use With Caution The horizontal line can be useful in different circumstances, like you can see in the next example : a footnote. <hr /> <p>1. "The Hobbit", JRR Tolkein.<br /> 2. "The Fellowship of the Ring" JRR Tolkein.</p> Display 1. "The Hobbit", JRR Tolkein. 2. "The Fellowship of the Ring" JRR Tolkein. As you can see, everything that this tag does is to draw a horizontal line separating different parts of the content or it just decorates the page. Use it...

Line break

A line break is different from the other tags that we have seen before. The place we put it in the source cod of the document, will end the line and it will go down with a line , letting a space which is smaller the the one from the paragraph. In the paragraph is used , as you can see, in the next example. <p> Charles Brownstone <br /> Florida Street No 1 <br /> New York, USA <br /> </p> Display Charles Brownstone Florida Street No 1 New York, USA   As well it can be used for pointing out a signature , for example at the end of a letter. <p> Thank You,<br /> <br /> <br /> Charles Brownstone <br /> Vice-President </p>...

HTML - Titles 1:6 (Headings)

In HTML, a title is exactly what it looks : a real title or a subtitle.When you put a text in a tag <h1> , the text will be bolded, and the dimension of the letter will be the same with the number of the heading. The titles can have dimensions form 1 to 6 , where 1 is the smallest dimension and 6 the biggest dimension. <body> <h1>Headings</h1> <h2>are</h2> <h3>great</h3> <h4>for</h4> <h5>titles</h5> <h6>and subtitles</h6> </body> Display You can see that every title has a linebreak before and after. Every time you...

Paragraph's attribute

The paragraph is a base element in text editing.The tag for a paragraph is <p>. He places a empty line above and under the text to make it evident, and the browser will take it as it is. <p> The paragraph is a base element in ... </p> <p> This places a empty line above and ... </p> Display The paragraph is a base element in text editing.The tag for a paragraph is <p>. He places a empty line above and under the text to make it evident, and the browser will take it as it is HTML - Paragraph, justifyParagraphs can be edited almost the same easy way as in a text editor. The next example is made with the help of the justify attribute <p align="justify">The...

HTML attributes 1

The attributes are used to personalize tags. What do i mean ? Somehow , someday you want to resize a image or a table or to change a font color. All these are possible with the help of the attributes. The most tags have their own attributes. We will talk about this as we include in our talking a new tag. But now we will talk about a set of generic attributes which can be used with the majority of the tags. Attributes are putted between the angular brackets (<>) of the opening tag. THe "class" and "id" attributes in HTML These two attributes are mostly the same. They have no straight role in the formatting of the elements but they are useful behind the scene with the help of CSS. We will talk their role at the right...

Html tags

A browser read absolutely all you write in the HTML document. Tags have three parts as I said before, the opening, closing and content. As you will learn there are hundreds of HTML tags. Absolutely all the elements that will be displayed by a browser need a tag or two. <openingtag>Content</closingtag> <p>Paragraph</p> Tags are written in small letters. This is the standard of writing in XHTML, and Dynamic HTML. Above are some examples of tags in HTML. <body> acts as a capsule on the content. <p>paragraph</p> <h2>Title (heading)< h2>...

HTML Elements

HTML elements have many ranks.All you see : paragraphs, ZiZix`s banner, the navigation links from the left side and the right side , all are elements of this page.An element has three parts : an opening tag, element`s content and an closing.<p> - the tag that opens a paragraph Element`s content - the paragraph itself. </p> - the closing tag. ***Note: All the web pages will have at least the base elements: html, head, title and body.-------------------------------------------------------------------------------------------------------------------------- <html>element...</html>An HTML document will always begin and end with a <html> tag and respective </html>. This is the standard structure of an HTML. Please open a Notepad and copy the next...

Pages 81234 »

Share

Twitter Delicious Facebook Digg Stumbleupon Favorites More