Enter Keyword Hear for Search This Blog

Friday, 22 June 2018

Server-Side Versus Client-Side Scripting

Server-Side Versus Client-Side Scripting

As already explained, PHP code is processed at the Web server before anything is returned to the browser. This is referred to as server-side processing. Most Web programming works this way: PHP, ASP, Perl, C, and others.

However, a few languages are processed by the browser after it receives the page. This is called client-side processing. The most common example of this is JavaScript.

TIP : Despite the similarity in their names, Java and JavaScript are far from being the same. Many Web developers are familiar with JavaScript, but this does not make them Java programmers. It’s important to remember that these languages are not the same.

This can lead to an interesting problem with logic. The following example demonstrates what I mean:

<script language=”JavaScript”>
if (testCondition())
{
<?php
echo “<b>The condition was true!</b>”;
?>
} else {
<?php
echo “<b>The condition was not true.</b>”;
?>
}
</script>

Many times the programmer of such a segment expects only one of the echo statements to execute. However, both will execute, and the page will be left with JavaScript that will generate errors (because the information in the echo statements is not valid JavaScript code). If this is a little unclear, read on; the following demonstration should clear things up for you.

NOTE : If you’re not familiar with JavaScript, don’t worry. The important concept behind this discussion is that PHP, being a server-side language, will be evaluated before the JavaScript, which is a client-side language. This won’t be an issue if you don’t use a client-side scripting language like JavaScript.

The resulting code from the previous snippet follows; notice that the JavaScript has been left intact and untouched, but the PHP code has been evaluated. PHP ignores the JavaScript code completely:

<script language=”JavaScript”>
if (testCondition())
{
<b>The condition was true!</b>
} else {
<b>The condition was not true.</b>
}
</script>

As you can see, this code will cause JavaScript errors when executed. Be cautious when combining PHP and JavaScript code: It can be done, but it must be done with attention to the fact that the PHP will always be evaluated without regard for the JavaScript. To successfully combine the two, it’s generally necessary to output JavaScript code with PHP.

The following example does just that:

<script language=”JavaScript”>
if (testCondition())
{
<?php
echo “document.write(‘<b>The condition was true!</b>’);”;
?>
} else {
<?php
echo “document.write(‘<b>The condition was not true.</b>’);”;
?>
}
</script>

As you can see, doing this gets complicated very quickly, so it’s best to avoid combining PHP and JavaScript. However, the resulting code below shows you that this will work.

<script language=”JavaScript”>
if (testCondition())
{
document.write(‘<b>The condition was true!</b>’);
} else {
document.write(‘<b>The condition was not true.</b>’);
}
</script>

How Embedded Programming Works

How Embedded Programming Works

Before now, I’ve only mentioned that PHP code must be enclosed in the <?php and ?> PHP tags. Using tags to separate PHP code and HTML code within the same file allows programming code to be mixed directly with information that is going to be sent to the browser just as it is. This makes PHP an embedded programming language because PHP code is embedded directly in HTML code.

This concept is relatively new: Before languages like PHP, programs had no real need to display data using a structured formatting language as complex as HTML. Information displayed on the screen was usually just letters, numbers, and spaces, without many colors, sizes, or other formatting markups.

Since PHP was made for Web programming, it is intended to be used with HTML, which significantly increases the amount of information that has to be sent back to the browser. Not only does PHP have to send back the information the user sees, but also the markup tags required to format the information correctly.

To make the mixing of information and markup tags simpler, PHP code is embedded directly in the HTML page where the information is desired. The example at the beginning of this chapter demonstrates this concept quite clearly; the program is mostly regular HTML code, but PHP is also used to insert some information.

Embedded programming will make your job as a programmer much easier; you can add programming where you need it and use regular HTML the rest of the time. However, be sure to enclose your PHP code in PHP tags or your code will not be parsed, but rather displayed on the HTML page.

The following program provides another example of embedded programming :

<?php
/* File: hello_world.php – displays “Hello, World!” */
?>
<html>
<head><title>Hello, World!</title></head>
<body bgcolor=”white” text=”black”>
Hello,
<?php
// Send “World!” to the visitor’s browser
echo “World!”;
?>
</body>
</html>

When this file is accessed through a Web server, the PHP interpreter will process the file line by line from the top to bottom. Thus, the information before the opening PHP tag is sent to the browser, along with the result of the echo statement. The Web browser receives an HTML file that looks like this:

<html>
<head><title>Hello, World!</title></head>
<body bgcolor=”white” text=”black”>
Hello, World!
</body>
</html>

The browser then displays the file just as it would any other HTML file.

Monday, 2 April 2018

Variable Types

Variable Types
Variable Types
Variable Types



Integers

An integer is any numeric value that does not have a decimal point, such as the following:

• 5 (five) 
• –5 (negative five) 
• 0123 (preceded by a zero; octal representation of decimal number 83) 
• 0x12 (preceded by 0x; hexadecimal representation of decimal number 18)

Floating-Point Numbers

A floating-point number (commonly referred to simply as a float or double, which, in PHP, are exactly the same thing) is a numeric value with a decimal point.

The following are all floating-point values:

• 5.5 
• .055e2 (scientific notation for .055 times 10 to the second power, which is 5.5) 
• 19.99

The second example is a float represented in scientific notation. The e, as is often the case on graphing calculators, means “times 10 to the”. It is followed by whatever power 10 should be raised to in order to put the decimal wherever you want it. Thus, .055e2 is the same as .055 times 100, which is 5.5.

Arrays

ARRAY INDEXING

The following example demonstrates the construction of an array containing

five names, then printing each name on a separate line:

<?php
/* ch02ex03.php – demonstration of arrays */
$namesArray = Array(‘Joe’, ‘Bob’, ‘Sarah’, ‘Bill’, ‘Suzy’);
echo “$namesArray[0]<br>”;
echo “$namesArray[1]<br>”;
echo “$namesArray[2]<br>”;
echo “$namesArray[3]<br>”;
echo “$namesArray[4]<br>”;

?>

NOTE : The <br> tags are given here to separate each element of the array on a separate line.

The following example demonstrates the use of empty brackets after an
array to add new elements and also explicitly defines a certain element in

an array:

$namesArray = Array(‘Joe’, ‘Bob’, ‘Sarah’, ‘Bill’, ‘Suzy’);
$namesArray[] = ‘Rachel’; // adds ‘Rachel’ as $namesArray[5]

$namesArray[3] = ‘John’; // replaces ‘Bill’ with ‘John’


Strings

Single-quoted strings are always interpreted just as they are. For example, to use “My variable is called $myVariable” as a string, use the statement found in the following example:

<?php
/* ch02ex04.php – shows use of single-quoted strings */
echo ‘My variable is called $myVariable’;

?>

The output from this example is

My variable is called $myVariable


As you may have noticed from the echo statements found earlier in this
chapter, double-quoted strings are interpreted so that variables are
expanded before they are actually stored as a value. Consider the following

example:

<?php

/* ch02ex05.php – shows use of double-quoted strings */
// Do single-quote assignment and output result
$myVariable = ‘My variable is called $myVariable’;
echo $myVariable;
// Move to new line
echo ‘<br>’;
// Do double-quote assignment and output result
$myVariable = “My variable is called $myVariable”;echo $myVariable;

?>

The output from this example is :

My variable is called $myVariable

My variable is called My variable is called $myVariable

CHARACTER ESCAPING

The following example uses character escaping to include $strSmall’s name
and its contents surrounded by quotes inside the string $strBig:

<?php
/* ch02ex06.php – demonstrates character escaping */
$strSmall = “John Smith”;

$strBig = “The name stored in \$strSmall is \”$strSmall\”.”;
echo $strBig;

?>

Thus, the output of the above program is

The name stored in $strSmall is “John Smith”.


STRING INDEXING

$string{index}

For example, take a look at the following program:

<?php
/* ch02ex07.php – demonstrates string indexing */
// Assign a name to $strName
$strName = “Walter Smith”;
// Output the fifth letter of the name
echo $strName{4};
?>

Objects
Objects are a powerful method of program organization. They are essentially what people are talking about when they refer to OOP or Object- Oriented Programming. Objects (and their definitions, called classes) are discussed in depth in Chapter 12, “Using Include Files (Local and Remote).”

server side versus client-side scripting

Server Side Versus Client Side Scripting
Server Side Versus Client Side Scripting


As already explained, PHP code is processed at the Web server before anything is returned to the browser. This is referred to as server-side processing. Most Web programming works this way: PHP, ASP, Perl, C, and others.

However, a few languages are processed by the browser after it receives the page. This is called client-side processing. The most common example of this is JavaScript.

NOTE : Despite the similarity in their names, Java and JavaScript are far from being the same.
Many Web developers are familiar with JavaScript, but this does not make them Java
programmers. It’s important to remember that these languages are not the same.

This can lead to an interesting problem with logic. The following example
demonstrates what I mean:

<script language=”JavaScript”>
if (testCondition())
{
<?php
echo “<b>The condition was true!</b>”;
?>
} else {
<?php
echo “<b>The condition was not true.</b>”;
?>
}
</script>


The resulting code from the previous snippet follows; notice that the
JavaScript has been left intact and untouched, but the PHP code has been
evaluated. PHP ignores the JavaScript code completely:

<script language=”JavaScript”>
if (testCondition())
{
<b>The condition was true!</b>
} else {
<b>The condition was not true.</b>
}
</script>

As you can see, this code will cause JavaScript errors when executed. Be
cautious when combining PHP and JavaScript code: It can be done, but it
must be done with attention to the fact that the PHP will always be evaluated
without regard for the JavaScript. To successfully combine the two, it’s

generally necessary to output JavaScript code with PHP.
The following example does just that:

<script language=”JavaScript”>
if (testCondition())
{
<?php
echo “document.write(‘<b>The condition was true!</b>’);”;
?>
} else {
<?php
echo “document.write(‘<b>The condition was not true.</b>’);”;
?>
}

</script>

As you can see, doing this gets complicated very quickly, so it’s best to avoid
combining PHP and JavaScript. However, the resulting code below shows

you that this will work.

<script language=”JavaScript”>
if (testCondition())
{
document.write(‘<b>The condition was true!</b>’);
} else {
document.write(‘<b>The condition was not true.</b>’);
}

</script>

Wednesday, 7 March 2018

How to download multiple file using php code

Download Multiple File in PHP

<?php

extract($_GET);

$link=mysql_connect("localhost","root","");

mysql_select_db("converter",$link);

$query="select * from multiple where id=$id";

$res=mysql_query($query,$link);

while($row=mysql_fetch_assoc($res))


$getfile=$row['PdfFilename'];

header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.$getfile);
header('Content-Transfer-Encoding: binary');

$file = @ fopen($getfile, 'rb') or die("Techincal Error");    

fpassthru($file);
        
?>

How to delete multiple record in database using php language

Delete Multiple Record

<?php session_start();

extract($_GET);

$link = mysql_connect("localhost","root","");

mysql_select_db("converter",$link);

$q="delete from multiple where id=".$id;

mysql_query($q,$link);

header("location:itop.php");

//$_SESSION['del_er']['dd'] = mysql_affected_rows()." Video Sub-category Deleted";
?>

Friday, 23 February 2018

How to make login page

<?php session_start(); ?>
<html>
<head>
  <?php include('inc/head.php'); ?>
</head>
<body>
  <div class="container">
    <div class="header text-center">
      <?php include("inc/header.php"); ?>
    
      <nav class="navbar navbar-inverse" role="navigation">
        <?php include("inc/menu.php"); ?>
      </nav>
    </div>
    <div class="row">
      <div class="col-lg-3">
        <?php include("inc/sidebar.php"); ?>
      </div>
    <!-- </div>
    <div class="row"> -->
      <div class="col-lg-9">
        <div class="bs-component">
          <div class="panel panel-primary">
            <div class="panel-heading">
              <h3 class="panel-title">First Signin</h3>
            </div>
            <div class="panel-body">
              <h1>Signin</h1>
              <hr/>
              <div class="col-lg-5">
                <?php 
                  if (isset($_SESSION['login']))
                  {
                    echo '<span class="alert alert-success">'.$_SESSION['login'].'</span>';
                  }
                ?>
                <form action="login_pro.php" method="post">
                  <?php 
                    if (isset($_SESSION['sess_log']['email']))
                    {
                      echo '<span class="alert alert-danger">'.$_SESSION['sess_log']['email'].'</span>';
                    }
                    elseif (isset($_SESSION['sess_log']['che']))
                    {
                      echo '<span class="alert alert-danger">'.$_SESSION['sess_log']['che'].'</span>';
                    }
                    if (isset($_SESSION['sess_log']['notval']))
                    {
                      echo '<span class="alert alert-danger">'.$_SESSION['sess_log']['notval'].'</span>';
                    }
                  ?>
                  <input type="text" name="email" class="form-control" autofocus placeholder="Enter Email-Id" />
                  <br/>
                  <?php 
                    if (isset($_SESSION['sess_log']['pwd']))
                    {
                      echo '<span class="alert alert-danger">'.$_SESSION['sess_log']['pwd'].'</span>';
                    }unset($_SESSION['sess_log']);
                  ?>
                  <input type="password" name="pwd" class="form-control" placeholder="Enter Password" />
                  <br/>
                  <a href="register.php" class="text-success">Create New User</a><br/>
  <a href="forget.php" class="text-info">Forgate Password</a><hr>
                  <input type="submit" value="SignIn" class="btn btn-info" />
                </form>
              </div>   
            </div>
          </div>
        </div>        
      </div>
    </div>


  </div>
</body>
</html>

How to make feedback form

<?php session_start(); ?>
<html>
<head>
  <?php include('inc/head.php'); ?>
</head>
<body>
  <div class="container">
    <div class="header text-center">
      <?php include("inc/header.php"); ?>
    
      <nav class="navbar navbar-inverse" role="navigation">
        <?php include("inc/menu.php"); ?>
      </nav>
    </div>
    <div class="row">
      <div class="col-lg-3">
        <?php include("inc/sidebar.php"); ?>
      </div>
    <!-- </div>
    <div class="row"> -->
      <div class="col-lg-9">
        <div class="bs-component">
          <div class="panel panel-primary">
            <div class="panel-heading">
              <h3 class="panel-title">Feedback</h3>
            </div>
            <div class="panel-body">
              <h1>Feedback</h1>
              <hr/>
              <div class="col-lg-5">
                <?php 
                  if (isset($_SESSION['feed_error']['fcom']))
                  {
                    echo '<span class="alert alert-success">'.$_SESSION['feed_error']['fcom'].'</span>';
                  }
                ?>
                <form action="feedback_pro.php" method="post">
                  <input type="text" name="unm" class="form-control" autofocus placeholder="Enter Your Name" />
                  <?php 
                    if (isset($_SESSION['feed_error']['unm']))
                    {
                      echo '<span class="alert alert-danger">'.$_SESSION['feed_error']['unm'].'</span>';
                    }
                  ?>
                  <br/>
                  <input type="email" name="email" class="form-control" autofocus placeholder="Enter Email-Id" />
                  <?php 
                    if (isset($_SESSION['feed_error']['email']))
                    {
                      echo '<span class="alert alert-danger">'.$_SESSION['feed_error']['email'].'</span>';
                    }
                    if (isset($_SESSION['feed_error']['email2']))
                    {
                      echo '<span class="alert alert-danger">'.$_SESSION['feed_error']['email2'].'</span>';
                    }
                  ?>
                  <br/>
                  <input type="text" name="mno" class="form-control" autofocus placeholder="Enter Mobile No" />
                  <?php 
                    if (isset($_SESSION['feed_error']['mno']))
                    {
                      echo '<span class="alert alert-danger">'.$_SESSION['feed_error']['mno'].'</span>';
                    }
                    if (isset($_SESSION['feed_error']['mnolen']))
                    {
                      echo '<span class="alert alert-danger">'.$_SESSION['feed_error']['mnolen'].'</span>';
                    }unset($_SESSION['reg_error']);
                  ?>
  <br/>
  <textarea name="sub" class="form-control" placeholder="Enter Your Subject"></textarea>
  <?php 
                    if (isset($_SESSION['feed_error']['sub']))
                    {
                      echo '<span class="alert alert-danger">'.$_SESSION['feed_error']['sub'].'</span>';
                    }
                    unset($_SESSION['feed_error']);
                  ?>
                  <br/>
                  <input type="submit" value="Submit" class="btn btn-info" />
                </form>
              </div>   
            </div>
          </div>
        </div>        
      </div>
    </div>


  </div>
</body>
</html>

Thursday, 22 February 2018

How to make contact page

<?php session_start(); 
  if(!isset($_SESSION['email']))
  {
    header('location:login.php');
  }
?>
<html>
<head>
  <?php include('inc/head.php'); ?>
</head>
<body>
  <div class="container">
    <div class="header text-center">
      <?php include("inc/header.php"); ?>
    
      <nav class="navbar navbar-inverse" role="navigation">
        <?php include("inc/menu.php"); ?>
      </nav>
    </div>
    <div class="row">
      <div class="col-lg-3">
        <?php include("inc/sidebar.php"); ?>
      </div>
    <!-- </div>
    <div class="row"> -->
      <div class="col-lg-9">
        <div class="bs-component">
          <div class="panel panel-primary">
            <div class="panel-heading">
              <h3 class="panel-title">
                Contact
              </h3>
            </div>
            <div class="panel-body img">
              <div class="bootshape">
                <div class="page-header">
                  <h1>Contact</h1>
                </div>
                <blockquote>
                  <p>Full Name.</p>
                  <footer>Bhavsinh Chauhan</footer>
                </blockquote>
                <blockquote>
                  <p>Email Id.</p>
                  <footer><a href="bhavsinh.chauhan123@gmail.com">bhavsinh.chauhan123<cite title="Source Title">@gmail.com</cite></a></footer>
                </blockquote>
                <blockquote>
                  <p>Mobile No.</p>
                  <footer>769847 <cite title="Source Title">4949</cite></a></footer>
                </blockquote>
                <blockquote>
                  <p>Addresh.</p>
                  <footer>Saurashtra University  <cite title="Source Title"></cite></a></footer>
                  <footer>Girnar Boys Hostel near Munjka Gam  <cite title="Source Title"></cite></a></footer>
                  <footer>Rajkot 360005  <cite title="Source Title"></cite></a></footer>
                </blockquote>
                <!-- <blockquote class="blockquote-reverse">
                  <p>Mobile No.</p>
                  <footer>769847 <cite title="Source Title">4949</cite></footer>
                </blockquote> -->
              </div>
            </div>
          </div>
        </div>        
      </div>
    </div>


  </div>
</body>
</html>

How to make about page

<?php session_start(); 
  if(!isset($_SESSION['email']))
  {
    header('location:login.php');
  }
?>
<html>
<head>
  <?php include('inc/head.php'); ?>
</head>
<body>
  <div class="container">
    <div class="header text-center">
      <?php include("inc/header.php"); ?>
    
      <nav class="navbar navbar-inverse" role="navigation">
        <?php include("inc/menu.php"); ?>
      </nav>
    </div>
    <div class="row">
      <div class="col-lg-3">
        <?php include("inc/sidebar.php"); ?>
      </div>
    <!-- </div>
    <div class="row"> -->
      <div class="col-lg-9">
        <div class="bs-component">
          <div class="panel panel-primary">
            <div class="panel-heading">
              <h3 class="panel-title">
                About
              </h3>
            </div>
            <div class="panel-body">
              <div class="row aboveimg">
                <div class="col-md-10">
                  <h1>Two types of converter is there.</h1>
                  </br>
                  <div class="panel-group" id="accordion">
                    <div class="panel panel-default">
                      <div class="panel-heading">
                        <h4 class="panel-title">
                          <a data-toggle="collapse" data-parent="#accordion" href="#collapseOne">
                            1.Image to Pdf Convert
                          </a>
                        </h4>
                      </div>
                      <div id="collapseOne" class="panel-collapse collapse in">
                        <div class="panel-body">
                          <h4>1. Single Image convert</h4>
                          <p>
                            - Only convert single image extension is jpg,png,gif<br/>
                            - With validation<br/>
                            - After convert image is go gallary folder in and pdf file create PDF/ folder in
                          </p>

                          <h4>2. Multiple Image convert</h4>
                          <p>
                            - Bydefault you have five file-Box is provide, image extension is jpg,png,gif valid.<br/>
                            - With validation.<br/>
                            - After convert pdf is go PDF/ folder in and image go gallary/ folder in.<br/>
                            - Click (+) button you have get one extra file-box. <br/>
                            - You have compresh all image in single pdf and individual pdf in.<br/>
                          </p>
                        </div>
                      </div>
                    </div>
                    <div class="panel panel-default">
                      <div class="panel-heading">
                        <h4 class="panel-title">
                          <a data-toggle="collapse" data-parent="#accordion" href="#collapseTwo">
                            2.Pdf to Html Convert
                          </a>
                        </h4>
                      </div>
                      <div id="collapseTwo" class="panel-collapse collapse">
                        <div class="panel-body">
                          <h4>1. Single Image convert</h4>
                          <p>
                            - Only convert single pdf file into html extension is pdf,text<br/>
                            - With validation<br/>
                            - After convert pdf file is go pdftohtml/pdf/ folder in and html file create pdftohtml folder in
                          </p>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>        
      </div>
    </div>
  </div>
</body>
</html>

Sunday, 18 February 2018

How to send mail using php code

<?php
header('Content-type: application/json');
$status = array(
'type'=>'success',
'message'=>'Email sent!'
);

    $name = @trim(stripslashes($_POST['fnm']));
    $name = @trim(stripslashes($_POST['lnm'])); 
    $email = @trim(stripslashes($_POST['email'])); 
    $email = @trim(stripslashes($_POST['subject'])); 
    $message = @trim(stripslashes($_POST['message'])); 

    $email_from = $email;
    $email_to = 'email@gmail.com';

    $body = 'fName: ' . $fnm . "\n\n" . 'lName: ' . $lnm . "\n\n" . 'Email: ' . $email . "\n\n" . 'Subject: ' . $subject . "\n\n" . 'Message: ' . $message;

    $success = @mail($email_to, $subject, $body, 'From: <'.$email_from.'>');

    echo json_encode($status);
    die;
?>

Monday, 1 January 2018

USING THE BORDER ATTRIBUTE

USING THE BORDER ATTRIBUTE

<HTML>
  <HEAD>
    <TITLE>Working with Images</TITLE>
  </HEAD>
  <BODY STYLE="background-image:url(image/1.gif);">
     <B>Controlling Image Borders!</B>
     <CENTER>
       <I>Image Without a BORDER</I>
       <BR/><BR/>
       <IMG src="iamges/2.gif"/>
       <BR/><BR/>
       <I>Image With border-width:3px;</I>
       <BR/><BR/>
       <IMG STYLE="border-width:3px;" src="iamges/2.gif"/>
       <BR/>
     </CENTER>
  </BODY>
</HTML>

HYPER TEXT MARKUP LANGUAGE(HTML)

HYPER TEXT MARKUP LANGUAGE

The language used to develop web pages is called Hyper Text Markup Language (HTML). HTML is the language interpreted by a Browser. Web Pages are also called HTML documents. HTML is a set of special codes that can be embedded in text to add formatting and linking information. HTML is specified as TAGS in an HTML document (i.e. the Web page).

HTML TAGS
Tags are instructions that are embedded directly into the text of the document. An HTML tag is a single to a browser that it should do something other than just throw text up on the screen. By convention  all HTML tags begin with an open angle bracket(<) and end with a close angle bracket(>).

HTML tags can be of two types:

Paired Tags
A tag is said to be a paired tag if it, along with a compation tag, flanks the text. For example the <B> tag is a paired tag. The <B> tag with its companion tag </B> causes the text contained between them to be rendered in bold. The effect of other paired tag is applied only to the text they contain.

In paired tags, the first tag (<B>) is often called the opening tag and the second tag (</B>) is called the closing tag.

The opening tag activates the effect and the closing tag turns the effect off.

Singular Tags
The second type of tag is the singular or stand-alone tag. A stand-alone tag does not have a companion tag For Example <BR/> tag will insert a line break. This tag does not require any companion tag.

Note :
Some HTML tags require additional information to be supplied to them. For instance, when a picture is placed on the screen, information like the height and width of the picture can be specified.

Additional information supplied to an HTML tag is known as Attributes of a tag. Attributes are written immediately following the tag, separated by a space Multiple attributes can be associated with a tag, also separated by a space.

Featured post

what is ajax?how to create ajax with php code

Ajax Introduction -  એજેક્સ નો ઉપીયોગ કરી ને તમે પેજ લોડ કાર્ય વિના બધી માહિતી મેળવી શકો.એજેક્સ થી તમે કોઈ પણ ડેટા ઝડપ થી મેળવી શકો છો...