Google+ PHP TUTORIALS ONLINE HELP FOR MEDICAL AND PROGRAMMING: 2014

Wednesday 17 September 2014

File Upload Script in PHP

File Upload Script in PHP
<html>
<head>
<title>File Upload Script</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<div>
<?php
if ( isset( $_FILES['fupload'] ) ) {
print "name: ". $_FILES['fupload']['name'] ."<br />";
print "size: ". $_FILES['fupload']['size'] ." bytes<br />";
print "temp name: ".$_FILES['fupload']['tmp_name'] ."<br />";
print "type: ". $_FILES['fupload']['type'] ."<br />";
print "error: ". $_FILES['fupload']['error'] ."<br />";
if ( $_FILES['fupload']['type'] == "image/gif" ) {
$source = $_FILES['fupload']['tmp_name'];
$target = "upload/".$_FILES['fupload']['name'];
move_uploaded_file( $source, $target );
$size = getImageSize( $target );
$imgstr = "<p><img width=\"$size[0]\" height=\"$size[1]\" ";
$imgstr .= "src=\"$target\" alt=\"uploaded image\" /></p>";
print $imgstr;
}
}
?>
</div>
<form enctype="multipart/form-data"
action="<?php print $_SERVER['PHP_SELF']?>" method="post">
<table
<tr>
<td><input type="hidden" name="MAX_FILE_SIZE" value="102400" /></td>
</tr>
<tr>
<td><input type="hidden" name="MAX_FILE_SIZE" value="102400" /></td>
</tr>
<tr>
<td><input type="file" name="fupload" /></td>
</tr>
<tr>
<td><input type="submit" value="upload!" /></td>
</tr>
</table>

</form>
</body>
</html>

Friday 12 September 2014

HTML5 Input Element

HTML5 Input Element

We have discus HTML5 Input Element tag.you can following example of using radio buttons,labels, and submit buttons:

Example
<!DOCTYPE html>
<head><title>HTML5 Input Element</title></head>
<meta http http-equiv="keywords" content="How to create HTML5 Input Element"/>
<html>
<form action="#" method="post">
<p>
<label for="name">Name: </label>
<input type="text" id="name"><br />
<label for="address">Address: </label>
<input type="text" id="address"><br />
<label for="email">email: </label>
<input type="text" id="email"><br>
<input type="radio" name="sex" value="male"> Male<br>
<input type="radio" name="sex" value="female"> Female<br>
<input type="submit" value="send"> <input type="reset">
</p>
</form>
</html>

Saturday 21 June 2014

how to create responsive menu using html5 and css3

how to create responsive menu using html5 and css3

In this example we have created responsive menu. First of all  we have design menu using for HTML5 and CSS3. In this example we have used desktop browse and we have also use mobile tab browser.
You can copy this code.  you can run this code.

Menu.html    

    <!DOCTYPE type>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link rel="stylesheet" type="text/css" href="style.css" />
    <title>Untitled Document</title>
    <script>
     function showMenu()
    {
    //document.write("fj");
    if(document.getElementById("menu").style.display=="block")
    {
   document.getElementById("menu").style.display="none";
    }
   else
   document.getElementById("menu").style.display="block";
    }

   </script>

   </head> 

   <body>
   <button id="hk" onclick="showMenu()"> Show Menu </button>
   <nav class="nav">
   <ul class="nav-list" id="menu">
   <li class="nav-item"><a href="#">Home</a></li>
   <li class="nav-item"><a href="#">About</a></li>
   <li id="service" class="nav-item"><a href="#">Services</a>
   <ul id="service_items">
   <li><a href="#">Service A</a></li>
   <li><a href="#">Service A</a></li>
    <li><a href="#">Service A</a></li>
    <li><a href="#">Service A</a></li>
   <li><a href="#">Service A</a></li>
   </ul> 
   </li>
   <li class="nav-item"><a href="#">Portfolio</a>
   <ul id="service_items">
   <li><a href="#">Service A</a></li>
   <li><a href="#">Service A</a></li>
   <li><a href="#">Service A</a></li>
   <li><a href="#">Service A</a></li>
   <li><a href="#">Service A</a></li>
   </ul> 
  </li>
   <li class="nav-item"><a href="#">Testimonials</a>
    <ul id="service_items">
    <li><a href="#">Service A</a></li>
    <li><a href="#">Service A</a></li>
   <li><a href="#">Service A</a></li>
   <li><a href="#">Service A</a></li>
   <li><a href="#">Service A</a></li>
   </ul> 
   </li>
  <li class="nav-item"><a href="#">Contact</a></li>
   </ul>
   </nav>
   </body>
   </html>

style.css



@charset "utf-8";
/* CSS Document */


@media screen and (max-width: 820px)
{
ul
{
display:none;
}
ul li ul
{
list-style-type: none;
}
ul
{
list-style-type:none;
}

ul{display:none;}
ul li:hover ul
{
display:block;
}


.nav-item a {
display:block;
padding:15px 20px;
color:#FFF;
background:rgba(23,54,34,0.4);
}
.nav-item:first-child a {

}
.nav-item:last-child a {
border-radius:5px;
}
.nav-item a:hover {
background:#2C3E50;
}


ul li
{
margin:1px;
width:180px;
border-radius:5px;
}

ul li ul{margin-left:-40px; }
ul li ul li {
display:block;
padding:5px 5px;
color:#FFF;
background:#666666;
border:1px solid black;
}

}


/* Desktop CSS */
@media screen and (min-width: 821px)
{
ul li ul
{
list-style-type: none;
display:none;
}

ul li:hover ul
{
display:block;
}


#hk
{
display:none;
}
.nav {
position:relative;
display:inline-block;
font-size:14px;
font-weight:900;
}
.nav-list {

}
.nav-item {
float:left;
display:inline;
zoom:1;
}
.nav-item a {
display:block;
padding:15px 20px;
color:#FFF;
background:#34495E;
}
.nav-item:first-child a {
border-radius:5px 0 0 5px;
}
.nav-item:last-child a {
border-radius:0 5px 5px 0;
}
.nav-item a:hover {
background:#2C3E50;
}
ul li
{
width: 140px;
}
ul li ul{margin-left:-40px; }

ul li ul 
{
width: 90px;
}
ul li ul li a {
display:block;
padding:5px 5px;
color:#FFF;
text-decoration: none;
background:red;
border:1px solid black;
}

ul li ul li a:hover{ 
background:blue;
}
}

Desktop Screen output:
Mobile Screen output:

  

Sunday 8 June 2014

How to display value in HTML5

How to display value in HTML5

In this example how to display value in html5. We have use html5 tag like " label" and " input type".We have displayed some text fields and submit bottom and we have css . we have used java script function.

form.html

<!Doctype html>
<html>
<head>
<style>

}
#header {
width:550px;
height: auto;
}
#header, h1 {
font-size: 30px; font-style: inherit; text-align: center;
display: block;
}
#form123
{
text-align: left; margin-top: 50px;

width: 550px;
height: auto;
margin: auto;

}

#form123 label, input, textarea {

width: 300px;
height: 40px;
display: block;
font-family: sans-serif;
font-size: 20px;
}
#sub {
margin-top: 15px;
width: 140px;

font-size:200px;
}
</style>

</head>
<body>
<div id="header">
<h1>Contact Form</h1>
</div>
<div id="form123" >

<form type=get action="page2.html">
<!--Name -->
<label for = "name">Name:<span class="star">*</span></label>
<input required type="text" name="name" id="name"></br>
<!--Address -->
<label for = "address">Address:<span class="star">*</span></label>
<textarea required id = "address" name="address"></textarea></br>
<!-- Password -->

<label for = "password">Password*</label>
<input type = "password" id = "password" name="password" required pattern="(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{6,}" onChange="form.pwd2.pattern = this.value;"/>
<br/>

<label for="confirmPassword">Confirm Password*</label>
<input type = "password" id = "confirmPassword" name="confirmPassword" required pattern="(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{6,}"/>
<br/>
<label for="telephone">Contact Number <span class="star">*</span></label>
<input type = "Number" id = "telephone" name="telephone" required maxlength="10"/></br>

<input type = "submit" text = "Submit" id="sub"/>
</form>
</div>
</body>
</html>

page2.html

<!Doctype html>
<html>
<script LANGUAGE="JavaScript">
function getParams(){
var idx = document.URL.indexOf('?');
var params = new Array();
if (idx != -1) {
var pairs = document.URL.substring(idx+1, document.URL.length).split('&');
for (var i=0; i<pairs.length; i++){
nameVal = pairs[i].split('=');
params[nameVal[0]] = nameVal[1];
}
}
return params;
}
params = getParams();
name = unescape(params["name"]);
address = unescape(params["address"]);
password = unescape(params["password"]);
confirmPassword = unescape(params["confirmPassword"]);
telephone = unescape(params["telephone"]);
document.write("Name: = " + name + "<br>");
document.write("Address : = " + address + "<br>");
document.write("Password : = " + password + "<br>");
document.write("Confirm Password : = " + confirmPassword + "<br>");
document.write("Telephone : = " + telephone + "<br>");
</script>
</html>
 
Display Form  

Display value

Monday 19 May 2014

How to Remove the Default Image Link in WordPress?

How to Remove the Default Image Link in WordPress?

you know that when you upload an image to WordPress media library, it creates multiple copies of the image in different image sizes. By default it adds a link to the image file. You can set this default link to none to remove the link, but doing it manually each time you upload an image is a little annoying. It is also annoying for users to click on an image and find the same image on the media page as well. Add this code in your theme’s functions.php file to remove default image link functionnality.

function wpb_imagelink_setup() {
$image_set = get_option( 'image_default_link_type' );

if ($image_set !== 'none') {
update_option('image_default_link_type', 'none');
}
}
add_action('admin_init', 'wpb_imagelink_setup', 10);

Saturday 17 May 2014

How to start WordPress blog's

How to use WordPress Blog's

 In this video tutorial we have discus  How to start WordPress blog's . You can see full video tutorial after that you can start create site easy way.

WordPress Video Tutorials

 WordPress Video Tutorials

In this tutorial we have provided you with detailed instructions on how to use WordPress to create and manage your site. WordPress can be used for both simple and complex websites. In our WordPress tutorial we have tried to cover all the basics and few advanced topics.
you can see full video tutorials.


Wednesday 26 March 2014

Fibonacci series program in php

Fibonacci series program in php

// Fibonacci series program in php?.
 //In mathematical terms, the sequence Fn of Fibonacci numbers is defined by the recurrence relation.
Example

<html>
<head>
<title>Fibonacci series program in php</title>
</head>
<body>

 <?php
  $count= 0;
 $x = 0;
 $y = 1;
 echo $x."<br/>";
 echo $y."<br/>";
 while($count<10){
 $z = $x + $y;
    echo $z."<br />";
    $x = $y;
    $y = $z;
    $count ++;
 }
?>
</body>
</html>
output:
0
1
1
2
3
5
8
13
21
34
55

89

Monday 24 March 2014

Prime numbers in between a range of 100

Program to find prime numbers in between a range of 100

Prime Number example in PHP. We will print the prime number between a range of 100.The prime number is not divisible by 2 only divisible by 1 and itself.

Example
    <html>
     <head>
      <title>PHP Prime Numbers</title>
         </head>
          <body>
     <?php
       error_reporting(E_ALL);
         //Program to find prime numbers in between a range of 100
        $num =100;
          for( $j = 2; $j <= $num; $j++ )
            {
        for( $k = 2; $k < $j; $k++ )
       {
           if( $j % $k == 0 )
       {
         break;
        }
        }
           if( $k == $j )
          echo "Prime Number : ", $j, "<br>";
          }
        ?>
</body>
</html>

Output
Prime Number : 2
Prime Number : 3
Prime Number : 5
Prime Number : 7
Prime Number : 11
Prime Number : 13
Prime Number : 17
Prime Number : 19
Prime Number : 23
Prime Number : 29
Prime Number : 31
Prime Number : 37
Prime Number : 41
Prime Number : 43
Prime Number : 47
Prime Number : 53
Prime Number : 59
Prime Number : 61
Prime Number : 67
Prime Number : 71
Prime Number : 73
Prime Number : 79
Prime Number : 83
Prime Number : 89
Prime Number : 97

Reverse String, without strrev()

Reverse String, without strrev()

In this example we have discus how to print  Reverse String, without strrev() function .Fist off all we Assign the given string to the variable and Calculate the length of the string. We use Iterate the string using for loop with appropriate looping and count Concatenate the string inside the for loop. you can see below example.

Example

   <html>
   <head>
   <title>Reverse</title>
   </head>
    <body>
    <?php
            $string = 'Hello php';
                 $length = strlen($string);
           for ($i=($length-1) ; $i >= 0 ; $i--) {
       echo $string[$i];
       }
      ?>
</body>
</html>

Output:  php olleH

PHP strrev() Function

We can also print without loop

< html>
<html>
<body>

<?php
     echo strrev("Hello World!");
     ?>

</body>
</html>

How to reverse a number in php without built(strrev()) in functions

In this example First off all we get the given number and extract the final digit. Initially the reverse of the number will be zero, on each iteration multiply the reverse with 10 and add the modulus result.you can see below example.

Example

 <html>
 <head>
 <title>reverse number</title>
 </head>
 <body>
      <?php
               $number = 1234; $x =0; $y =0;
                  $originalnum = $number;
                  while($number > 1) {
            $x = $number %10;
              $y = ($y * 10)+ $x;
             $number = $number /10;
           }
          Echo "Original Number: ". $originalnum;
          Echo " Reverse : ". $y;
          ?>
</body>
</html>

Output: Original Number: 1234 Reverse : 4321 

Sunday 16 March 2014

Insert Data From a Form Into a Database

User Registration Form with DataBase

In this example we have discus how to Insert Data From a Form Into a Database. First all we have created HTML From and we display some "text" fields and radio Button. we have also use form validation and we use JavaScript function which is called on checkForm(form).when we click the submit button in the HTML From,the form data is sent to "insert.php".The "insert.php" file connects to a database, and retrieves the values from the form with the PHP $_POST variables.Then, the mysqli_query() function executes the INSERT INTO statement, and a new record will be added to the "Persons" table.

Example

form.html
<html>
<head>
<title>User Registration Form</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<h1 align="center">User Registration Form with DataBase</h1>
<script type="text/javascript">

  function checkForm(form)
  {
    if(form.firstname.value == "") {
      alert("Error: FirstName cannot be blank!");
      form.firstname.focus();
      return false;
    }
if(form.lastname.value == "") {
      alert("Error: LastName cannot be blank!");
      form.lastname.focus();
      return false;
    }
if(form.address.value == "") {
      alert("Error: Address cannot be blank!");
      form.address.focus();
      return false;
    }
if(form.city.value == "") {
      alert("Error: City cannot be blank!");
      form.city.focus();
      return false;
    }
if(form.pincode.value == "" ||
           isNaN(form.pincode.value) ||
           form.pincode.value.length != 6 )
   {
     alert( "Please provide a pincode in the format ######." );
     form.pincode.focus() ;
     return false;
   }
 if( form.country.value == "-1" )
   {
     alert( "Please provide your Country!" );
     form.country.focus() ;
     return false;
   }

  if(form.mobileno.value == "" ||
           isNaN( form.mobileno.value) ||
           form.mobileno.value.length != 10 )
   {
     alert( "Please provide a Mobile No in the format 123." );
     form.mobileno.focus() ;
     return false;
   }

if ( ( form.sex[0].checked == false ) && ( form.sex[1].checked == false ) )
   {
   alert ( "Please choose your Gender: Male or Female" );
   return false;
   }
 
if(form.age.value == "") {
      alert("Error: Age cannot be blank!");
      form.age.focus();
      return false;
    }
var email = form.emailid.value;
  atpos = email.indexOf("@");
  dotpos = email.lastIndexOf(".");
 if (email == "" || atpos < 1 || ( dotpos - atpos < 2 ))
 {
     alert("Please enter correct email ID")
     form.emailid.focus() ;
     return false;
 }
if(form.pwd1.value != "" && form.pwd1.value == form.pwd2.value) {
      if(form.pwd1.value.length < 6) {
        alert("Error: Password must contain at least six characters!");
        form.pwd1.focus();
        return false;
      }
      if(form.pwd1.value == form.username.value) {
        alert("Error: Password must be different from Username!");
        form.pwd1.focus();
        return false;
      }
      re = /[0-9]/;
      if(!re.test(form.pwd1.value)) {
        alert("Error: password must contain at least one number (0-9)!");
        form.pwd1.focus();
        return false;
      }
      re = /[a-z]/;
      if(!re.test(form.pwd1.value)) {
        alert("Error: password must contain at least one lowercase letter (a-z)!");
        form.pwd1.focus();
        return false;
      }
      re = /[A-Z]/;
      if(!re.test(form.pwd1.value)) {
        alert("Error: password must contain at least one uppercase letter (A-Z)!");
        form.pwd1.focus();
        return false;
      }
    } else {
      alert("Error: Please check that you've entered and confirmed your password!");
      form.pwd1.focus();
      return false;
    }

    alert("You entered a valid password: " + form.pwd1.value);
    return true;
  }

</script>

<body bgcolor="#9999FF" text="#000000" leftmargin="30">
<strong>
<table align="center" border="1">
<form action="insert.php" method="post" onsubmit="return checkForm(this);">
<tr>
<td>FirstName</td>
<td><input type="text" name="firstname" size="30"></td>
</tr>
<tr>
<td>LastName</td>
<td>  <input type="text" name="lastname" size="30"></td>
</tr>

<tr>
<td>Address</td>
<td> <input type="text" name="address" size="30"></td>
</tr>

<tr>
<td>City</td>
<td>  <input type="text" name="city" size="30"></td>
</tr>

<tr>
<td>Pincode</td>
<td> <input type="text" name="pincode" size="30"></td>
</tr>

<tr>
<td>Country</td>
<td><select name="country">
           <option value="-1" selected>select..</option>
           <option value="india">India</option>
           <option value="usa">USA</option>
           <option value="canada">Canada</option>
           <option value="pakistan">Pakistan</option>
           </select></td>
</tr>

<tr>
<td>Mobile No</td>
<td> <input type="text" name="mobileno" size="30"></td>
</tr>

<tr>
<td>Gender</td>
<td><input type="radio" name="sex" value="Male"> Male
                   <input type="radio" name="sex" value="Female"> Female</td>
</tr>

<tr>
<td>Age</td>
<td>  <input type="text" name="age" size="30">    </td>
</tr>
<tr>
<td>Email Id</td>
<td> <input type="text" name="emailid" size="30"> </td>
</tr>

<tr>
<td>Password:  </td>
<td>  <input type="password" name="pwd1" size="30"></td>
</tr>
<tr>
<td>Confirm Password:  </td>
<td><input type="password" name="pwd2" size="30"></td>
</tr>

<tr>
<td></td>
<td>  <input type="submit"/></td>
</tr>
</form>
</table>
</strong>
</body>
</html>

insert.php

       <htm>
      <head>
      <title>inserData</title>
      </head>

       <body>
      <?php
          $con=mysqli_connect('localhost','root','','userregistraion');
         // Check connection
         if (mysqli_connect_errno())
         {
      echo "Failed to connect to MySQL: " . mysqli_connect_error();
     }

          $sql="INSERT INTO userinformation (FirstName, LastName, Address, City, 
            PinCode, Country, MobileNo, Sex, Age, Emailid, Pwd1, Pwd2)VALUES
          ('$_POST[firstname]','$_POST[lastname]','$_POST[address]','$_POST[city]','$_POST[pincode]','
 $_POST[country]','$_POST[mobileno]','$_POST[sex]','$_POST[age]','$_POST[emailid]',                  '$_POST[pwd1]','$_POST[pwd2]')";

       if (!mysqli_query($con,$sql))
      {
         die('Error: ' . mysqli_error($con));
          }
          echo "1 record added";

         mysqli_close($con);
                ?>

         </body>
        </html>

Output:


SQL result:-



Tuesday 11 March 2014

create table in mysql php example

How to create table in mysql php example

In this example we have created table in MySQL PHP. We have created  table UserInformation "FirstName", "LastName" ,"Address" ,"Age"). We have added the CREATE TABLE statement to the mysqli_query() function to execute the command.

MySQL Syntax:-
$sql="CREATE TABLE UserInformation(FirstName CHAR(30),LastName CHAR(30),Address CHAR(50),Age INT)";

Example:

<html">
<head>
<title>Create Table</title>
</head>
<body>
<?php

$connection=mysqli_connect('localhost','root','','naulej');
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
// Create table
$sql="CREATE TABLE UserInformation(FirstName CHAR(30),LastName CHAR(30),Address CHAR(50),Age INT)";
// Execute query
if (mysqli_query($connection,$sql))
{
echo "Table UserInformation created successfully";
}
else
{
echo "Error creating table: " . mysqli_error($connection);
}
?>
</body>
</html>

Output:-




















Error creating table

Wednesday 5 March 2014

How to create database in PHP

How to create database in PHP


Example


<html">
<head>

<title>Create Data Base</title>
</head>
<body>
<?php
 $con=mysqli_connect('localhost','root','','mydatabase');
  // Check connection
 if (mysqli_connect_errno())
  {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
  }

// Create database
$sql="CREATE DATABASE PHPAdmin";
if (mysqli_query($con,$sql))
  {
  echo "Database PHPAdmin created successfully";
  }
else
  {
  echo "Error creating database: " . mysqli_error($con);
  }
?>
</body>
</html>

Thursday 27 February 2014

RDBMS COURSE CONTENTS

RDBMS COURSE CONTENTS

DATA MODELS

Database Management Systems
Data Models
  • Object-Base Logical Model
  • Record-Based Logical Model
  • Steps for Creating an ER Diagram.
Relational Operators
  • RESTRICT
  • PROJECT
  • PRODUCT
  • UNION
  • INTERSECT
  • DIFFERENCE
  • JOIN
  • DIVIDE
DATABASE DESIGN
Conceptual Model
  • Mapping ER Diagrams to Table
Tips on Logical Database Design
  • Attributes
  • Keys
  • Entities
  • Subentities
Normalizing and denormalizing Data

Understanding Data Redundancy
  • Definition of Normalization
Undaerstanding Denormalization
  • Definition of Denormalization

Introduction to C++

Introduction to C++

Hi! Welcome to my beginners guide to C++. If you are starting to program for the First time. C++ is an excellent Language to start programming in – a lot of applications that you use are probably written in  C++  and once you learn some basic concepts, learning other languages, like java for example, will be much easier.

After each topic you can rearrange the code in the examples provided or make up your own code. Programming is very much a practical subject so you will learn a lot by messing about with code or even looking at other people’s code.
Visits All C++ Tutorials

Tuesday 25 February 2014

C++ with Programming Techniques

C++ with Programming Techniques

Introduction to C++
What is C++ Programming?
The Object-Oriented Approach
  •  Encapsulation
  •   Polymorphism
  •  Inheritance What's new in C++?
  •   New Style Header
  •   Namespaces
  •   The main() Function
  •   New Comment Style
  •   Input and Output
  •  The return Statement Data Types and Variable
  •  The bool Data Type
  •  The Reference Data Type
Operators, Expression and Statements Operators
  • The Assignment Operator
  •  Mathematical Operators
  •   Relational and Logical Operators
  •   Bitwise Operators
  •   The ? Operator
  •   The & and * Pointer Operators
  •   The size of Operator
  •   The Comma Operator
  •   The Dot (.) and Arrow (−>) Operators
  •   The [ ] and ( ) Operators
  •  Operator Precedence
Expressions
  • Simple Expressions
  • Complex Expressions Statements
  •  Statements and White Space
  •  Null Statements Compound Statements
  •  More Statements
True and False in C ++
Selection Statements
  • if Statement
  • Nested ifs
  •  The if-else-if Ladder
  •  The ? Alternative
  •  The Conditional Expression
  •  The switch Statement
  • Nested switch Statements Iteration Statements
  •  The for Loop
  •  for Loop Variations
  • The Infinite Loop
  •  for Loops with No Bodies
  •  The while Loop
  • The do-while Loop Jump Statements
  •  The return Statement
  •  The goto Statement
  •  The break Statement
  •  The exit( ) Function
  •  The continue Statement
Arrays, Strings and Pointer Basics Arrays
  • Declaration of an Array
  • Initializing Arrays
  • Storage Capacity of an Array
  • Two-Dimensional Arrays
  • Unsized Array Initializations Strings
  • Null-Terminated Strings
  • String Manipulation Functions
  • Arrays of Strings
Pointers – A Brief Overview
  • Definition of a Pointer
  • Declaring a Pointer
  •  How Pointer Work?
  • Initializing Pointers
Pointer Expressions
  • Pointer Assignments
  •  Pointer Arithmetic
  •  Pointer Comparisons Pointers and Arrays
  • Arrays of Pointers
  • Pointers Vs. Array Dynamic Memory Allocation
  • What is Dynamic Memory Allocation?
  • Allocating Memory
  • Freeing Memory
  • Reallocating Memory
  • Common Pointer Pitfalls
  • Not Assigning a Pointer to Memory Address before Using It
  • Illegal Indirection
Classes and Objects
  • Introduction to Classes
  • What is a Class?
  • Creating a Class
  • Accessing Class Members Introduction to Objects
  • What are Objects?
  •  Creating Objects
  •  Accessing an Object’s Data Members and Member Functions
  • The Current Object
  • The “This” Alternative
  • Deleting an Object
Constructors and Destructors
  • Constructor
  • Destructor
  • Parameterized Constructors Static Class Members
  •  Static Data Members
  •  Static Member Functions
  • When Constructors and Destructors Are Executed The Scope Resolution Operator
Overloading
  • Function Overloading
  • Overloading a Function
  • Overloading Constructor Functions
  • Overloading a Constructor to Gain Flexibility Allowing Both Initialized and Uninitialized Objects
  • Copy Constructors
  • Finding the Address of an Overloaded Function
  • Default Function Arguments
  • Default Arguments vs. Overloading
  • Operator Overloading
  • Operator Overloading – An Overview
  •  Overloading an Operator
  • Creating a Member Operator Function
  • Creating a Non-Member Operator Function
  • Overloading new and delete Overloading new and delete for Arrays Overloading the no throw Version of new and delete
Inheritance
  • Inheritance – An Overview
  • What is Inheritance?
  • Benefits of Using Inheritance Base-Class Access Control
  • Inheritance and public and private Members
  • Inheritance and protected Members
  • Protected Base-Class Inheritance Implementing Multiple Inheritance
  • Constructors, Destructors, and Inheritance
  • Execution Order of Constructors and Destructors
  • Passing Parameters to Base-Class Constructors Restoring Access
  •  Virtual Base Classes Polymorphism in C++ Virtual Functions
  • What is a Virtual Function?
  • Creating a Virtual Function
  • An Example
  • Virtual Function vs Function Overloading
  •  Calling a Virtual Function Through a Base Class Reference Inheriting Virtual Attribute
  • Virtual Functions Are Hierarchical Pure Virtual Functions
  • Discussing Pure Virtual Functions
  •  Discussing Abstract Classes
  •  Using Virtual Functions
  • Early vs. Late Binding
Exception Handling
  • Basics of Exception Handling
  • The try and catch Block
  • The throw Statement
  • Some Examples Catching Class Types
  • Using Multiple catch Statements
  • Handling Derived-Class Exceptions
  • Exception Handling Options
  • Catching All Exceptions
  • Restricting Exceptions
  • Rethrowing an Exception Understanding terminate( ) and unexpected( )
  • Overview of terminate() and unexpected()
  • Setting the Terminate and Unexpected Handlers
  • An Example
  • The uncaught_exception( ) Function
  • The exception and bad_exception Classes
File Handling in C++
  • Handling Files – An Overview
  • Opening and Closing a File
  • Streams For File Manipulation
  • Opening a File
  • Verifying Whether File Is Opened Successfully
  • Closing a File
  • Reading and Writing Text Files
  • Performing Unformatted and Binary I/O
  • The put( ) and get( ) Functions
  • The read( ) and write( ) Functions
  • More get( ) Functions
  • The getline( ) Function
  • Detecting EOF
  • Using the ignore( ) Function
  • Using peek( ) and putback( ) Functions Using flush( ) Function
  • Randoming Access of Files
  • Obtaining the Current File Position
You can read All C++ programming

Saturday 22 February 2014

Multidimensional Array

Multidimensional Array

Today we are going to discus multidimensional array. A multidimensional array is an array containing one or more arrays.In this example we have used multidimensional arrays.

Example

<!DOCTYPE html>
<head>
<title>Multidimensional Array</title>
</head>
<body>
<?php
$cars= array
    (
    array("Honda",1000,100),
    array("BMW",60,59),
    array("Toyota",120,100)
    );
echo $cars[0][0].": Ordered: ".$cars[0][1].". Sold: ".$cars[0][2]."<br>";
echo $cars[1][0].": Ordered: ".$cars[1][1].". Sold: ".$cars[1][2]."<br>";
echo $cars[2][0].": Ordered: ".$cars[2][1].". Sold: ".$cars[2][2]."<br>";
?>
</body>
</html>

Output

Honda: Ordered: 1000. Sold: 100
BMW: Ordered: 60. Sold: 59
Toyota: Ordered: 120. Sold: 100

Friday 21 February 2014

Web Devloper


How to start PHP programming in windows?

How to start PHP programming in windows?


First of all I will teach you how to start PHP programming in windows? You will manually download PHP setup like as wamp server or xampp setup, than you will install in you computer after that gentare for icon . than you will restart in you system.Than you will click php setup after that, you will check  Apache Server and MySQL is running or not  running. If Apache server is running .
 
How to check Apache server is running or not

First of all you will open browse like as Mozilla Internet Explore  than you will type for http://localhost:81, Local host is running.and you will start php programming.In case Apache Server is not running than, you problem is port .port 81 is already in use. you can change port number (config.ex) files,  than Apache is running..
you can see below this image.....




Hello World Example

       Hello World Example

       <html>
       <head>
        <title>Hello World</title>
         </head>
        <h>Welcome my first PHP Page</h>

       // PHP script start with <?php code ?>
        
          <?php
            ECHO "Hello World!";

             ?>

          </html>

Output:-
         Welcome my first PHP Page.
                    Hello World

Tuesday 18 February 2014

PHP Data Types

PHP Data Types

Today i will teach you. how we can use PHP data types.
There are Seven types of PHP Data Types.
  1. String.
  2.  Integer.
  3.  Floating point numbers,
  4.  Boolean.
  5.  Array.
  6.  Object.
  7.  NULL.
String Data type:-The string is a sequence of characters. we can be any text inside quotes. we have used single or double quotes. you can see below in examples
Example of String Data types:-
<html>
<head>
<title>String data type</title>
</head>
<body>
<?php 
$x= "Hello PHP";
$y= "Welcome to PHP";
echo $x;
echo "<br>";
echo $y;
?>
</body>
</html>
Output
Hello PHP
Welcome to PHP
 Integer Data type:-Integer is a basic data types. We can assign which has no of fractional part to int type but int is a 2 Byte space.
Importants Rules:
Integer is a least one digit (0-9).
Integer cannot contain comma or blanks.
Integer must not have a decimal point.
Integer can be either positive or negative values.
Now we can assign a value between the above range below example. In this example we have used different variables like as negative number, hexadecimal number ,octal numbers and we have used PHP var_dump(); function returns the data type.
Example
<html>
<head>
<title>Integer Data types</title>
</head>
<body>
<?php 
$y = 4567;
var_dump($y);
echo "<br>"; 
$y = -254; // negative number 
var_dump($y);
echo "<br>"; 
$y = 0x8C; // hexadecimal number
var_dump($y);
echo "<br>";
$y = 047; // octal number
var_dump($y);
?> 

</body>
</html>
Output
int(4567)
int(-254)
int(140)
int(39)

Monday 17 February 2014

PHP form Validation Example

PHP form Validation Example

In this example, we have discus how to use PHP Form Validation. First off all we have displayed HTML form with text fields and submit button. In this example we have used  method and function. First thing we had done is to pass all variables through PHP's htmlspecalchars() function. After the we fills all input field than ,we click submit button and  display all input fields values. Now we have used $_SERVER["REQUEST_METHOD"]. If the REQUEST_METHOD is POST, and submitted form. If user not submit input fields skip the validation and display a blank form.

Example of PHP Validation:
<!DOCTYPE HTML> 
<html>
<head>
</head>
<body> 

<?php

$name = $email = $gender = $address = $mobile = "";

if ($_SERVER["REQUEST_METHOD"] == "POST")
{
$name = test_input($_POST["name"]);
$email = test_input($_POST["email"]);
$mobile = test_input($_POST["mobile"]);
$address = test_input($_POST["address"]);
$gender = test_input($_POST["gender"]);
}

function test_input($data)
{
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}
?>
<h2>PHP Form Validation</h2>
<form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>"> 
<table llpadding="2" width="20%" bgcolor="99FFFF" cellspacing="2" border="1">
<tr>
<td>Name:</td> 
<td><input type="text" name="name"></td>
</tr>
<tr>
<td>E-mail:</td>
<td><input type="text" name="email"></td>
</tr>
<tr>
<td>Moblie No:</td>
<td><input type="text" name="mobile"></td>
</tr>
<tr>
<td>Address</td>
<td> <textarea name="address" rows="5" cols="20"></textarea></td>
</tr>
<tr>
<td>Gender:</td>
<td>
<input type="radio" name="gender" value="female">Female
<input type="radio" name="gender" value="male">Male</td>
</tr>
<tr>
<td>&nbsp; &nbsp;</td>
<td> <input type="submit" name="submit" value="Submit"> </td>
</tr>
</table>
</form>


<?php
echo "<h2><Your Input:</h2>";
echo $name;
echo "<br>";
echo $email;
echo "<br>";
echo $mobile;
echo "<br>";
echo $address;
echo "<br>";
echo $gender;
?>

</body>
</html>
Output

PHP Form Handling

PHP Form Handling

We are going to discus How to use PHP Form Handling. In this below example we have displays a simple  HTML form, and displays for Four Input Fields and submit button. After that user fills all input fields and click the submit button, the form data is send for processing to a PHP files named "Display.php". We use for post method, Post methods is send data HTTP.
We have used echo() method. Echo is a language construct and we can use without parameter parentheses:
Syntax
  <?php echo $_POST["Firstname"]; ?>
Form.html
<!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=utf-8" />
<title>Form Handling</title>
</head>
<h>PHP Form Handling</h>
<body>
<pre>
<form action="Display.php" method="post">
First Name: <input type="text" name="Firstname" id="fname">
Last Name: <input type="text" name="lastname" id="lname">
Address: <input type="text" name="address" id="address" />
Mobile No: <input type="number" name="number" id="number"/>
<input type="submit" name="submit" /> 
</form> 
</pre>
</body>
</html>
Dispaly.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=utf-8" />
<title>PHP welcome page</title>
</head>

<body>
Your First name is: <?php echo $_POST["Firstname"]; ?><br>
Your Last name is: <?php echo $_POST["lastname"]; ?><br>
Your Address is: <?php echo $_POST["address"]; ?><br>
Your Mobile number is: <?php echo $_POST["number"]; ?>
</body>
</html>

You can see below OutPut

PHP form Validation

PHP form Validation

We are going to discus how to use PHP Form Validation. Now First off all we have display HTML form with meny text fields and submit button First name, Lastname,MobileNo,PhoneNo Email, Address like so on In this example we have used many method and function. First thing we had done is to pass all variables through PHP's htmlspecalchars() function. After the we fills all input field than ,we click submit button and display all input fields values. Now we have used $_SERVER[REQUEST_METHOD]. If the REQUEST_METHOD is POST, and submitted form. If user not submit  all input fields than show for error massage please submit all  required fields and after that user click on the submit button than display all input fields
We have use for if and else statements
Example
<!DOCTYPE HTML> 
<html>
<head>
<style>
.error {color: #FF0000;}
body {
background-color: #D1D1D1;
}
</style>
<meta charset="utf-8">
</head>
<body> 

<?php
// Define variables and set to empty values:
$nameErr =$lnameErr = $emailErr = $mobilenoErr = $phonenoErr = $genderErr = $addressErr = "";
$name = $lname= $email = $mobileno = $gender = $address = $phoneno = "";

if ($_SERVER["REQUEST_METHOD"] == "POST")
{

if (empty($_POST["name"]))
{$nameErr = "Name is required";}
else
{$name = test_input($_POST["name"]);}

if (empty($_POST["lname"]))
{$lnameErr = "Last Name is required";}
else
{$lname = test_input($_POST["lname"]);}

if (empty($_POST["email"]))
{$emailErr = "Email is required";}
else
{$email = test_input($_POST["email"]);}

if (empty($_POST["mobileno"]))
{$mobilenoErr = "Mobile No is required";}
else
{$mobileno = test_input($_POST["mobileno"]);}

if (empty($_POST["phoneno"]))
{$phonenoErr = "Phone No No is required";}
else
{$phoneno = test_input($_POST["phoneno"]);}



if (empty($_POST["address"]))
{$addressErr = "Address is required";}
else
{$address = test_input($_POST["address"]);}

if (empty($_POST["gender"]))
{$genderErr = "Gender is required";}
else
{$gender = test_input($_POST["gender"]);}

}

function test_input($data)
{
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}
?>

<h2>PHP Form Validation Example</h2>

<table>

<form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>"> 
<tr>
<td>Name:</td>
<td> <input type="text" name="name"> <span class="error">* <?php echo $nameErr;?></span></td>

</tr>
<tr>
<td>Last Name:</td>
<td> <input type="text" name="lname"> <span class="error">* <?php echo $lnameErr;?></span></td>

</tr>

<tr>
<td> E-mail:</td>
<td> <input type="text" name="email"> <span class="error">* <?php echo $emailErr;?></span></td>
</tr> 

<tr>
<td> Mobile NO</td>
<td><input type="text" name="mobileno"> <span class="error">* <?php echo $mobilenoErr;?></span></td>
</tr> 

<tr>
<td>Phone No</td>
<td><input type="text" name="phoneno"> <span class="error">* <?php echo $phonenoErr;?></span></td>
</tr> 
<tr>
<td>Address:</td>
<td><textarea name="address" rows="5" cols="20"></textarea> <span class="error">* <?php echo $addressErr;?></span></td>
</tr> 
<tr>
<td> Gender:</td>
<td><input type="radio" name="gender" value="female">Female
<input type="radio" name="gender" value="male">Male
<span class="error">* <?php echo $genderErr;?></span></td>
</tr> 

<tr>
<td>&nbsp;</td>
<td> <input type="submit" name="submit" value="Submit"> </td>
</tr>
</form>
</table>


<?php
echo "<h2>Your Input:</h2>";
echo $name;
echo "<br>";
echo $lname;
echo "<br>";
echo $email;
echo "<br>";
echo $mobileno;
echo "<br>";
echo $phoneno;
echo "<br>";
echo $address;
echo "<br>";
echo $gender;
?>

</body>
</html>

Output