Archive for October 2012

jquery function for changing values of text boxes and dropdowns in rows if the checkbox of the row is checked

Sample jquery function for applying values to text box, select drop down for the selected checkboxes rows.

I have some rows with checkbox first, then a input field and a dropdown. I need to change the value of dropdowns and text boxes whose checkboxes are checked when click on a button. As there is no direct relationship between the checkbox, textbox and drop down, at first it seems to be difficult.

But in jquery it is so simple.

function btn_apply_all(){

        $("input[name='product_checkbox[]']").each(function(key) {
            if(this.checked){
                $("select[name='option_price[]']").each( function (key1){   
                    if(key1==key){   
                        $(this).val($("#cbo_bulk").val());   
                    }
                });
       
                $("input[name='txt_opt_price[]']").each( function (key1){
                    if(key1==key){   
                        $(this).val($("#txt_bulk_price").val());   
                    }
                });
       
            }
           
        });

    }

File Access Optimization

When you need to including file, please recheck file content that will be use. If file is not contains PHP codes, use readfile() function to increase performance.
Because files that including with readfile() does not parsing by PHP. It will be different with construction language include() and require(), and files will be evaluated before.

Consequence from using readfile() is increase attack risk. This risk will be happen when accessing file from URL.

Solution for the attack risk is by using File Handling.

ListGetAt

ListGetAt is a really cool ColdFusion function. Is great for grabbing values from a comma separated list (or any other delimited list)! I use this function a lot instead of the explode function. They essentially do the same, but using this function removes 1 step. Instead of first exploding the then getting the value for your array key. For the seasoned PHP coder and everyone else, the position will always start at 1 NOT 0. Also, the default delimiter is a ','(comma).

The Function:

function ListGetAt($list,$position,$delimiter=",")
{
$bit = explode($delimiter,$list);
return $bit[($position-1)];
}

Usage:

Using the ListGetAt function is quite easy!

<?php
$list =
"apples,oranges,grapes";
echo ListGetAt($list,1);
?>


The resulting out put would be: apples

<?php
$list = "apples+oranges+grapes";
echo ListGetAt($list,2,"+");
?>

The resulting out put would be: oranges



PHP beginners pdf tutorials free download

In this PHP tutorial section we are trying to provide you All pdf php tutorial for that you can learn PHP from home. This php pdf tutorials are free for all. Just download our PHP tutorial from media-fire link. Sometimes you feel bored or you are not get in touch with internet at this time you can open our pdf php tutorials and easily learn php without having internet. 

Free PHP pdf tutorial: 

We devided our whole pdf tutorial into three parts. In this part we will provide you beginners php PDF tutorials with media-fire link. So lets start and download our PHP pdf beginners tutorial. Here is the list of our beginners php tutorials. 

Starting with PHP web development.pdf
PHP intallation.pdf
ZAMPP installation.pdf
Vertrigo server installation.pdf
What is PHP.pdf
Writing your first php script.pdf
PHP variable.pdf
PHP comments.pdf
PHP operators index.pdf
PHP arithmetic operator.pdf
PHP assignment operator.pdf
PHP comparison operator.pdf
PHP increment and decrement operators.pdf
PHP control statement.pdf
PHP if statement.pdf
PHP swithc statement.pdf
PHP do-while loop.pdf
PHP while loop.pdf
PHP for loop.pdf
PHP break statement.pdf
PHP include once statement.pdf
PHP include statement.pdf
PHP form.pdf

At first download our PHP pdf tutorial and save it in your computer or notebook. It is an offline version and also a free tutorial so you can use our PHP pdf tutorial free. Share this tutorial with your friends and family. 

About me

My self Muhammed Shaheer Ul Haq, I am a PHP Expert in Karachi, Pakistan. I am working for five years (since 2007) and have worked in both large and small organizations as a PHP Developer. Usually as a Team Leader. PHP development is both my profession and a passion (that's why i love it). In the long run i gathered a lot of expertise in different eras including PHP Programming, JavaScript Programming, Web Services and AJAX Applications. And with each project, it is just getting better and better.

Hello World PHP

Now that you have installed XAMPP on your windows 7 pc and you have set Apache to run as a service to work around an issue with running Apache on windows 7, you're now ready to write the standard Hello World application in PHP!  To do this, you will need to create the PHP file in your htdocs directory. This directory is in the xampp directory.  If you installed XAMPP according to the instructions for windows 7, it should be C:\xampp\htdocs. You can think of this as the inetpub\wwwroot directory in ASP.NET. This is where all of your web site files will go when you're developing locally.  Now create a new folder called "helloworld" inside the htdocs directory. Once you have created this folder, create a new file using notepad++ or any editor of your choice.  Enter the following text into this file:

<?php
    echo 'hello world!';
?>

Once you have entered this text, save the file to your C:\xampp\htdocs\helloworld directory that you created as "index.php".   Then start apache, if it isn't already started.  Next, open up your browser and navigate to http://localhost/helloworld.  You should then see a web page with the "hello world!" text displayed.  Congratulations!  You have just created your first PHP page.

delete a file in php

<?php

if(isset($_POST['fname']))
{
  if(!empty($_POST['fname']))
  {
       $name=$_POST['fname'].'.txt';
  if(@!unlink($name))
  {
      echo 'there is no file to delete';
  }
  else
      echo 'file successfully deleted';
     }
}
?>

<form action="file-delete.php" method="POST">
file name : <input type="text" name="fname">
.txt
<input type="submit" value="submit">
</form>

output :
 note :
1) enter the file name  for delete that text file

Basic Database Loop to display records

<?
//You can use the following script to take data from database and list, for each round it will print the tr and also each round column color will be change with the class2 and class 3.
//I am sorry I can now write more about this, this is I am just posting for my reference, if you like you can use this. If you want to know more about this please post a comment, I will try my best to help you (If I am free).
?>
<table border="0" width="100%" cellpadding="5" style="border-collapse: collapse">
<tr>
<td class="class1" align="left" valign="top"><b>Staff Number</b></td>
<td class="class1" align="left" valign="top"><b>First Name</b></td>
<td class="class1" align="left" valign="top"><b>Last Name</b></td>
<td class="class1" align="left" valign="top"><b>Email Address</b></td>
<td class="class1" align="left" valign="top"><b>Date Of Birth</b></td>
</tr>
<?
$sql
= "SELECT * FROM tablename ORDER BY fldFirstName ASC";
$result = mysql_query($sql, $db);
$rows = mysql_num_rows($result);
if(
mysql_num_rows($result)) {
$howmany = 0;
for (
$i = 0; $i < $rows; $i++) {
$data = mysql_fetch_object($result);
$howmany = $howmany + 1;
$MYXXX = $howmany % 2;
switch (
$MYXXX) {
case
1:
$MYbgcolor = "class=\"class2\"";
break;

case
0:
$MYbgcolor = "class=\"class3\"";
break;
}
?>
<tr <?=$MYbgcolor?>>
<td align="left" valign="top"><?=$data->EmployeeNo?></td>
<td align="left" valign="top"><?=$data->FirstName?></td>
<td align="left" valign="top"><?=$data->LastName?></td>
<td align="left" valign="top"><?=$data->Email?></td>
<td align="left" valign="top"><?=$data->DateOfBirth?></td>
</tr>
<?
}
}
?>
</table>

PHP Membership Script


A good PHP membership script is very useful to get the information that you need from your niche market. There are a lot of software offering a good PHP membership script. Some of these software are free while some you have to buy. These membership scripts are very popular among marketing site owners.
If you need a membership script for your website, there is PHP membership script that you can get – the Multi-Membership site script.

Advantages of having the Multi-Membership Script
There are several advantages of using a good PHP membership script like the Multi-membership script. Here are just some of the advantages that it has:

·         Easy to maintain. The good thing about the suing the Multi-Membership script is that it is easy to maintain. With just one administration control the PHP membership can be controlled and customized so that it will suit the needs of the business. It also enables the user to have a control over what they want to offer.
·         Privacy and security. The good thing about this PHP membership script is that only you have the sole access to your customer database. The Multi-Membership Script has also ensured that all the information shared is secured.

·         Helps you earn. Another good thing about the Multi-Membership Script is that it helps you earn. It helps you earn through passive income or by earning money from the membership fees that are generated. You can also earn through its built-in sales force. This means mutual benefit between you and your customer. They earn by referring people and you earn from the signups gathered from the referrals. You can also earn income by selling advertisement to your site.

·         It is reliable and has its own support team. This PHP membership scrip software is good because you can always be sure that it will work and if there are bugs in the software you can always contact the technical support team and they are more than willing to answer your question.

The Multi-Membership Script Feature
There are several good features about this PHP membership script. One of the feature of this is that it can easily be installed in any server. The people who made the script designed it with the laypeople in mind, which is why it is easy to use.
This PHP membership script also allows for easy withdrawal of income. You can withdraw through PayPal, AlertPay, Moneybookers and E-Bullion.
It has a good admin setting that you can tweak and customize to your own liking. You can choose to have your clients receive confirmation emails or not. You can also choose the type of membership that you can offer. Also you can choose the payment methods for your clients.
You can even choose to add more banners to your site as well as add promotional advertisements.

Specifications
For the PHP membership script to run you need to have a Unix or Linux server. You also need to have a PHP 4.0 or higher and a Mysql database support. With these in place you can already have your Multi-Membership PHP membership script running. 

Php Web Designers Developers Website Programmers Articles on Free Press Release.com

Hello Friends ! !

Kindly Find Following Links for Php Website Design Website Development Articles on free-press-release.com

Php Web Development India Article on free-press-release.com

Php Web Designers Developers Programmers Article on free-press-release.com

Php Website Development Company India Pdf on free-press-release.com

These are very useful and most rated Php Web Development India Articles on free-press-release.com provides information on various Php Web Development India Services to the User and Clients.

Thanks & Regards

www.WeTheDevelopers.com

PHP ORACLE TUTORIAL

How to connect oracle database with PHP? it's easy:

Requirement:
A. Webserver, Apache is the most popular webserver.
B. PHP5.
C. Oracle Client (Optional)

1. Or the most simple way is by download webserver package it will include all requirement except oracle client you can find a lot of this kind of package for the example phpTriad and so on but im using easyPHP coz it's much easiest to configuration than other webserver package.

2. And then install the easyPHP, after installation completed run easy php by executing .exe file, easyPHP icon will appear on right below of windows toollbars.

3. Right click the icon go to configuration and click PHP extensions and we need oci and oracle module as basic requirement for PHP to understand the Oracle functionality, check the PHP_oci8 and PHP_oracle or you can edit manually from php.ini by remove ";"

;extension=php_oci8.dll
;extension=php_openssl.dll
;extension=php_oracle.dll

after:

extension=php_oci8.dll
;extension=php_openssl.dll
extension=php_oracle.dll

and then restart the apache and php

4. Ok next steep is for PHP script:
Herewith the connection script to oracle database:

$db = "(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.17.24.31)(PORT = 1521))(CONNECT_DATA = (SERVICE_NAME = cbsms)))";
$conn = OCILogon("VIEWONLYSMS","smg",$db)
or die( "Could not connect to Oracle database!")
or die(ocierror());
?>
and below is very simple search engine PHP-Oracle and then then display the result:

1. Search Form:






2. Search PHP:

$db = "(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = hostname)(PORT = port number))(CONNECT_DATA = (SERVICE_NAME = sid)))";
$conn = OCILogon("username","password",$db)
or die( "Could not connect to Oracle database!")
or die(ocierror());

$query="select * from table where $_POST[select] like '%$_POST[sms_id]%'";
//put the oracle query

$statement = ociparse ($conn, $query);
ociexecute ($statement);
?>







while ($row = ocifetch ($statement,OCI_DEFAULT)){
?>



}
?>
5. And done it's easy right?

Edit Registration form

<?php
error_reporting(0);
include("config.php");

$editID=$_GET['edit'];

$select=mysql_query("SELECT * FROM registered_user WHERE userid=$editID");

while($row=mysql_fetch_array($select))
{
/*echo "<pre>";
print_r($row);
echo "</pre>";*/

$firstname=$row['firstname'];
$middlename=$row['middlename'];
$lastname=$row['lastname'];
$username=$row['username'];
$password=$row['password'];
$decodedPassword=base64_decode($password);
$seX=$row['sex'];
$preflocation=$row['preflocation'];
$pLocation=explode(",",$preflocation);
$address=$row['address'];
$stdcode=$row['stdcode'];
$phoneno=$row['phoneno'];
$countrycode=$row['countrycode'];
$mobileno=$row['mobileno'];
$cityid=$row['city_id'];
$stateid=$row['state_id'];
$country=$row['country'];
}

$firstName=trim($_POST['txtFirstName']);
$middleName=trim($_POST['txtMiddleName']);
$lastName=trim($_POST['txtLastName']);
$userName=trim($_POST['txtUserName']);
$password=trim($_POST['txtPassword']);
$txtReTypePassword=trim($_POST['txtReTypePassword']);
$sex=$_POST['sex'];
$txtPLocation=$_POST['txtPLocation'];
$txtAreaAddress=trim($_POST['txtAreaAddress']);
$txtSTDNo=trim($_POST['txtSTDNo']);
$txtPhoneNo=trim($_POST['txtPhoneNo']);
$txtCountryCode=trim($_POST['txtCountryCode']);
$txtMobileNo=trim($_POST['txtMobileNo']);
$selectState=$_POST['selectState'];
$selectCity=$_POST['selectCity'];
$txtCountry=trim($_POST['txtCountry']);

if(isset($_POST['btnEdit']) && ($_POST['btnEdit']=="Edit"))
{
echo "<pre>";
print_r($_POST);
echo "</pre>";

/* $str=implode(",",$txtPLocation);
echo "1".$str;
echo "</pre>";*/

if(empty($firstName))
{
$strError[] .="<li>Please Enter First Name</li>";
}
if(empty($middleName))
{
$strError[] .="<li>Please Enter Middle Name</li>";
}
if(empty($lastName))
{
$strError[] .="<li>Please Enter Last Name</li>";
}
if(empty($userName))
{
$strError[] .="<li>Please Enter Username</li>";
}
if(empty($password))
{
$strError[] .="<li>Please Enter Password</li>";
}
if(empty($txtReTypePassword))
{
$strError[] .="<li>Please Re-Type Password</li>";
}
if(empty($sex))
{
$strError[] .="<li>Please Select Sex</li>";
}
if(empty($txtPLocation))
{
$strError[] .="<li>Please Select Preffered Location</li>";
}
if(empty($txtAreaAddress))
{
$strError[] .="<li>Please Enter Address</li>";
}
if(empty($txtSTDNo))
{
$strError[] .="<li>Please Enter STD Code</li>";
}
if(empty($txtPhoneNo))
{
$strError[] .="<li>Please Enter Phone No</li>";
}
if(empty($txtCountryCode))
{
$strError[] .="<li>Please Enter Country Code</li>";
}
if(empty($txtMobileNo))
{
$strError[] .="<li>Please Enter Mobile No</li>";
}
if(empty($selectState))
{
$strError[] .="<li>Please Select State</li>";
}
if(empty($selectCity))
{
$strError[] .="<li>Please Select City</li>";
}
if(empty($txtCountry))
{
$strError[] .="<li>Please Enter Country</li>";
}
if($password != $txtReTypePassword)
{
$strError[] .="<li>Password is not matched</li>";
}
if(!empty($firstName) && !empty($middleName) && !empty($lastName) && !empty($username) && !empty($password) && !empty($txtReTypePassword) && !empty($sex) && !empty($txtPLocation) && !empty($txtAreaAddress) && !empty($txtSTDNo) && !empty($txtPhoneNo) && !empty($txtCountryCode) && !empty($txtMobileNo) && !empty($selectState) && !empty($selectCity) && !empty($txtCountry))
   {
/*$mysqlSelect = "SELECT * FROM tbl_admin WHERE username='".$username."'";
$mysqlSelected = mysql_query($mysqlSelect);

$count = mysql_num_rows($mysqlSelected);

if($count > 0)
{
$strError[] .= "<li> Username is already exist </li>";
}
else*/ if($password == $txtReTypePassword)
{
$encodedPassword=base64_encode($password);
$txtPrefLocation=implode(",",$txtPLocation);

$sqlUpdateRUser = "UPDATE registered_user SET
firstname='".$firstName."',
middlename='".$middleName."',
lastname='".$lastName."',
username='".$userName."',
password='".$encodedPassword."',
sex='".$sex."',
preflocation='".$txtPrefLocation."',
address='".$txtAreaAddress."',
stdcode='".$txtSTDNo."',
phoneno='".$txtPhoneNo."',
countrycode='".$txtCountryCode."',
mobileno='".$txtMobileNo."',
state_id='".$selectState."',
city_id='".$selectCity."',
country='".$txtCountry."'
WHERE userid='".$editID."'";

$sqlUpdatedRUser = mysql_query($sqlUpdateRUser);

$sqlUpdateAdmin = "UPDATE tbl_admin SET
username='".$userName."',
password='".$encodedPassword."'
WHERE admin_id='".$editID."'";

$sqlUpdatedAdmin = mysql_query($sqlUpdateAdmin);

header('Location: useredited.php');
}
}
}
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Registration Form</title>
<link type="text/css" href="css/style.css" rel="stylesheet" />
</head>
<body>
<div id="regiheading">Registration Form
</div>
<div id="regiwrap" align="center">
<table width="620px" border="0" cellpadding="0" cellspacing="0">
<tr>
<td id="regileftcorntop">
</td>
<td id="regiupperstrip">
</td>
<td id="regirightcorntop">
</td>
</tr>
<tr>
<td colspan="3">
<form name="registrationFrm" action="" method="post" id="registrationID" enctype="multipart/form-data" target="">
<div align="center">
<table border="0" width="620" cellspacing="0" cellpadding="5" align="center">
<tr>
<td id="sideborder">
</td>
<td>
</td>
<td>
</td>
<td id="sideborder">
</td>
</tr>
<tr>
<td id="sideborder">
</td>
<td colspan="2" style="color:#FF0000; padding-left:100px;">
<?php foreach($strError as $key => $val)
 {  
echo $val;
 }
?>
</td>
<td id="sideborder">
</td>
</tr>
<tr>
<td id="sideborder">
</td>
<td id="namelabel">First Name :
</td>
<td id="namefields"><input type="text" name="txtFirstName" id="txtFirstNameId" value="<?php echo $firstname; ?>" size="35"/>
</td>
<td id="sideborder">
</td>
</tr>
<tr>
<td id="sideborder">
</td>
<td id="namelabel">Middle Name :
</td>
<td id="namefields"><input type="text" name="txtMiddleName" id="txtMiddleNameId" value="<?php echo $middlename; ?>" size="35"/>
</td>
<td id="sideborder">
</td>
</tr>
<tr>
<td id="sideborder">
</td>
<td id="namelabel">Last Name :
</td>
<td id="namefields"><input type="text" name="txtLastName" id="txtLastNameId" value="<?php echo $lastname; ?>" size="35"/>
</td>
<td id="sideborder">
</td>
</tr>
<tr>
<td id="sideborder">
</td>
<td id="namelabel">Username :
</td>
<td id="namefields"><input type="text" name="txtUserName" id="txtUsernameId" value="<?php echo $username; ?>" size="35"/>
</td>
<td id="sideborder">
</td>
</tr>
<tr>
<td id="sideborder">
</td>
<td id="namelabel">Password :
</td>
<td id="namefields"><input type="password" name="txtPassword" id="txtPasswordId" value="<?php echo $decodedPassword; ?>" size="35"/>
</td>
<td id="sideborder">
</td>
</tr>
<tr>
<td id="sideborder">
</td>
<td id="namelabel">Re-Type Password :
</td>
<td id="namefields"><input type="password" name="txtReTypePassword" id="txtReTypePasswordId" value="<?php echo $decodedPassword; ?>" size="35"/>
</td>
<td id="sideborder">
</td>
</tr>
<tr>
<td id="sideborder">
</td>
<td id="namelabel">Gender :
</td>
<td id="namefields"><input type="radio" name="sex" id="sexId" value="Male" <?php if($seX=='Male') echo 'checked'; ?>/>Male<span><input type="radio" name="sex" id="sexId" value="Female" <?php if($seX=='Female') echo 'checked'; ?>/>Female</span>
</td>
<td id="sideborder">
</td>
</tr>
<tr>
<td id="sideborder">
</td>
<td id="namelabel">Prefferd Location :
</td>
<td id="namefields"><input type="checkbox" name="txtPLocation[]" id="txtPLocationId" value="Sydney" <?php if($pLocation[0]=="Sydney" || $pLocation[1]=="Sydney" || $pLocation[2]=="Sydney") echo 'checked'; ?>>Sydney<span><input type="checkbox" name="txtPLocation[]" id="txtPLocationId" value="Ottawa" <?php if($pLocation[0]=="Ottawa" || $pLocation[1]=="Ottawa" || $pLocation[2]=="Ottawa") echo 'checked'; ?>>Ottawa</span><span><input type="checkbox" name="txtPLocation[]" id="txtPLocationId" value="Singapore" <?php if($pLocation[0]=="Singapore" || $pLocation[1]=="Singapore" || $pLocation[2]=="Singapore") echo 'checked' ; ?>>Singapore</span>
</td>
<td id="sideborder">
</td>
</tr>
<tr>
<td id="sideborder">
</td>
<td id="namelabel">Address :
</td>
<td id="namefields"><textarea cols="27" rows="5" name="txtAreaAddress" wrap=yes id="txtAreaAddressID"><?php echo $address; ?></textarea>
</td>
<td id="sideborder">
</td>
</tr>
<tr>
<td id="sideborder">
</td>
<td id="namelabel">Phone Number :
</td>
<td id="namefields"><input type="text" name="txtSTDNo" id="txtSTDNoId" size="4" value="<?php echo $stdcode; ?>" />-<input type="text" name="txtPhoneNo" id="txtPhoneNoId" size="26" value="<?php echo $phoneno; ?>" />
</td>
<td id="sideborder">
</td>
</tr>
<tr>
<td id="sideborder">
</td>
<td>
</td>
<td style="font-size:12px;">STD Code<span style="margin-left:50px;">Phone Number</span>
</td>
<td id="sideborder">
</td>
</tr>
<tr>
<td id="sideborder">
</td>
<td id="namelabel">Mobile Number :
</td>
<td id="namefields"><input type="text" name="txtCountryCode" value="<?php if($countrycode!='+91') echo $countrycode; else echo '+91';  ?>" size="4"  maxlength="3" />-<input type="text" name="txtMobileNo" id="txtMobileNoId" size="26" value="<?php echo $mobileno; ?>" />
</td>
<td id="sideborder">
</td>
</tr>
<tr>
<td id="sideborder">
</td>
<td id="namelabel">State :
</td>
<td id="namefields"><select name="selectState" style="width:239px;">
<option value="0">--- Select State ---</option>
<?php
$state=mysql_query("select * from tbl_state");
while($data=mysql_fetch_array($state))
{
$state_id=$data['state_id'];
$state_name=$data['state_name'];
?>
<option value="<?Php echo $state_id; ?>" <?php if($stateid==$state_id)echo 'selected' ?>><?Php echo $state_name; ?>
</option>
<?php } ?>
</select>
</td>
<td id="sideborder">
</td>
</tr>
<tr>
<td id="sideborder">
</td>
<td id="namelabel">City :
</td>
<td id="namefields"><select name="selectCity" style="width:239px;">
<option value="0">---- Select City ----</option>
<?php
$city=mysql_query("select * from tbl_city");
while($data=mysql_fetch_array($city))
{
$city_id=$data['city_id'];
$city_name=$data['city_name'];
?>
<option value="<?Php echo $city_id; ?>" <?php if($cityid==$city_id) echo 'selected'?>><?Php echo $city_name; ?>
</option>
<?php } ?>
</select>
</td>
<td id="sideborder">
</td>
</tr>
<tr>
<td id="sideborder">
</td>
<td id="namelabel">Country :
</td>
<td id="namefields"><input type="text" name="txtCountry" id="txtCountryId" size="35" value="<?php echo $country; ?>" />
</td>
<td id="sideborder">
</td>
</tr>
<tr>
<td id="sideborder">
</td>
<td>
</td>
<td>
</td>
<td id="sideborder">
</td>
</tr>
<tr>
<td id="sideborder">
</td>
<td id="namelabel">
</td>
<td id="namefields"><input type="submit" name="btnEdit" value="Edit" />
</td>
<td id="sideborder">
</td>
</tr>
<tr>
<td id="sideborder">
</td>
<td>
</td>
<td>
</td>
<td id="sideborder">
</td>
</tr>
</table>
</div>
</form>
</tr>
<tr>
<td id="regileftcornbot">
</td>
<td id="regilowerstrip">
</td>
<td id="regirightcornbot">
</td>
</tr>
</table>
</div>
</body>
</html>

Writing your first PHP script

You already knew how to set up PHP environment in personal computer. I hope you set all require software to run PHP code. If you do not set up PHP environment in your pc, I suggest you at first set up PHP environment in your pc. In our whole tutorial we use vertrigo web server and dreamweaver editor. 

Step to write first PHP code

At first run your server by double clicking on vertrigo server icon. Now you have to go to the server folder where you installed it. Then click on VertrigoServ folder and click on www folder. If you use ZAMP, click on htdocs folder. This is the place where you will keep your PHP code. Open a file helloworld with .php extension. Now your PHP file name is helloworld.php. It is required to add .php extension in each PHP file otherwise it will not work.   
Open the PHP file using Notepad or Dreamweaver and write the following code.

<?php
echo ”Hello Everyone, This Is My First PHP Code”;
?>

Save the code. Now it is time to see your first PHP code. Open your browser and write http://localhost/helloworld. It shows Hello Everyone, This Is My First PHP Code. In this code <?php is the php opening tag and ?> is the end tag. So we write our code within this tag. echo is a PHP built in function. We use this function to print php code.  


PHP Operators

PHP Operators
Below listed in the tables are the php operators, it is important that you memorize at least few of them.

Arithmetic Operators

Search Result

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

Comparison Operators

Operator

Description

Example

==

is equal to

5==8 returns false

!=

is not equal

5!=8 returns true

>

is greater than

5>8 returns false

<

is less than

5<8>

>=

is greater than or equal to

5>=8 returns false

<=

is less than or equal to

5<=8 returns true

Logical Operators

Operator

Description

Example

&&

and

x=6
y=3

(x <> 1) returns true

||

or

x=6
y=3

(x==5 || y==5) returns false

!

not

x=6
y=3

!(x==y) returns true