Amazon.com: PC Books || Educational Software || Magazines
Amazon: Books-CA || Software-CA || Books-UK || Software-UK

HTML | Javascript | ASP | PHP | VBScript | SQL | Hardware | PC FAQ| WinXP|

Learn to Build, Upgrade, or Repair your Computer Ebook + PC Safety 101 kwwebservice.com Reasonably priced web development & hosting
PHP Basics
Introduction
Variables & Arrays
Sub & Functions
If Statements
Case Statements
Loop Statements
Date Objects
Form Processing
Text File Objects
Database Access
Adding Record
Updating Record
Deleting Record
Virtual Includes
Cookies
Session
Server Variables
Creating Login Page
E-mail
PHP Books @
CA Amazon
UK Amazon
US Amazon

  :: Home
PC Topics
  :: Build A PC
  :: Windows XP
  :: PC Help
Tutorials
  :: HTML
  :: JavaScript
  :: ASP
  :: PHP
  :: VBScript
  :: SQL
Miscellaneous
  :: Code/Scripts
  :: Forum
  :: Links
  :: Contact us
  :: Tell A Friend
  :: In Somali
  ::
Web Articles
  Top Web Hosting
Reviews
  Processing
Online Card Payment Guide
  Domain name
registration & buying guide
  Getting
a website online guide
  Search Engine
submission & optimization tips
Netfirms Web Hosting
Free trial
Quality business correspondence.
Yahoo! Search Marketing


PHP If Statements

Using if statement, PHP has the ability to make distinctions between different possibilities. For example, you might have a script that checks if a variable consists certain type of values.

Here is syntax for PHP if statement.
<?php
if ( condition is true then)
{
   do something;
}
?>

Check the following if statement that checks if a variable has a value equal to 1 and also uses else option of if statement. If the condition is true, it writes first statement, if condition is not true, it writes the second statement.
<?php
$n=1;
if ($n==1)
{
    echo("N has the value equal to 1");
}
else
{
    echo("N is not equal to one");
}
?>

Nested If Statement

You would be able to check variety of conditions based on deversified values.  

The following example is nested if statement to check two conditions:
<?php
$fruit1="Apple";
$fruit2="Orange";
$in_store=1;
if($in_store==1)
{
   print "$fruit1 is in store";
}
elseif($in_store==2)
{
   print"$fruit2 is in store";
}
else
{
   print"No value specified";
}
?>
This if statement will check if the variable in_store is equal either 1 or 2 and displays fruit1 or fruit2 according to the true condition.  print will display the value of the specified variable.   It's similar to echo.   Execution result:
Apple is in store

Sub Procedures Case statement
Bluehost.com Web Hosting $6.95
PC System Tools
SpyCleaner
Registry Mechanic
4Diskclean Pro
Health PC Club
TweakNow
Registry Washer
SpyAnyWhere
System Lifeguard
...More/Details

PC Articles
  Computer Safety
prevent viruses & Spyware