Categories
PHP

US Dollar to Philippine Peso in PHP

 I wrote this simple program to ask the user to give us dollar value and then the program can convert the given us dollar into Philippine Peso currency value using PHP programming language.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following [email protected], [email protected], and [email protected]

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod City I also accepting computer repair, networking, and Arduino Project development at a very affordable price. My website is www.jakerpomperada.blogspot.com and www.jakerpomperada.com

If you like this video please click the LIKE button, SHARE, and SUBSCRIBE to my channel.

Your support on my channel is highly appreciated.

Thank you very much.

Program Listing

<html>
  <head> 
   <title>US Dollar to Philippine Peso in PHP </title>
  </head>
  <body> 
      <style type="text/css">
      
      body {
        font-family: arial;
            size: 12px;
      };

        </style>
    <?php
 
     $us_dollar = $_POST['us_dollar'];

  
   if(isset($_POST['submit'])) {
                  
      $phil_peso = ($us_dollar * 48.15);

      $results ="The Philippine Peso
       equivalent of $us_dollar US Dollar is PHP ".number_format($phil_peso,2);
    }

 if(isset($_POST['clear'])) {
      $us_dollar = "";
      $results = "";
    }
?>

  <h2> US Dollar to Philippine Peso in PHP </h2>
  <p> Mr. Jake Rodriguez Pomperada,MAED-IT, MIT </p>
<form method="post">
   <p>Give US Dollar <input 
    type="numeric" name="us_dollar"
     value="<?php echo $us_dollar; ?>" autofocus required /></p>
      
<input type="submit" name="submit" 
   title="Click here to compute the Philippine Peso value. "
   value="Submit" />
   
    &nbsp;&nbsp;&nbsp;
    <input type="submit" name="clear" 
    title="Click here to clear the textbox."
    value="Clear" />
</form>

<?php
   echo $results;
?>
</body>
</html>
Categories
PHP

CRUD using PDO in PHP and MySQL

In this tutorial I will show you how to create CRUD PDO application using PHP and MySQL.

 What is PDO?

   PDO = PHP Data Objects. This is a PHP extension that defines a consistent and lightweight interface for accessing databases.

    CRUD = Create/Read/Update/Delete. It means, any basic application that has ability to for creating, deleting, updating and reading the records in the database. Every database application like Inventory System, Accounting System, Point of Sale and other Business-related applications uses CRUD as basis of its database records manipulations.

 Contents for PHP PDO CRUD

  Creating a database having a table

          Establishing the database connection

       Creating and Reading records

      Edit records

    Delete a record

 I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following [email protected], [email protected], and [email protected]

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod City I also accepting computer repair, networking, and Arduino Project development at a very affordable price. My website is www.jakerpomperada.blogspot.com and www.jakerpomperada.com

If you like this video please click the LIKE button, SHARE, and SUBSCRIBE to my channel.

Your support on my channel is highly appreciated.

Thank you very much.

Program Listing

create.php





<?php

// create.php
// insert record in the table

include("connect.php");
$name   = "";
$telephone = "";
$mobile = "";
$email  = "";

if (isset($_POST['submit'])) {
    $name         = filter_var($_POST['name'], FILTER_SANITIZE_STRING); // to filter string
    $telephone    = filter_var($_POST['telephone'], FILTER_SANITIZE_EMAIL); // to filter email
    $mobile       = filter_var($_POST['mobile'], FILTER_SANITIZE_NUMBER_INT); // to filter number
    $email        = filter_var($_POST['email'], FILTER_SANITIZE_EMAIL); // to filter email
    $check_mobile = $conn->prepare("SELECT * FROM crud WHERE mobile = '" . $mobile . "'"); // to check duplicate records
    $check_mobile->execute();
    if ($check_mobile->rowCount() > 0) {
        header("Location: index.php?message=Duplicate entry");
    } else {
        $insert_query = $conn->prepare("INSERT INTO crud (name,telephone,mobile,email) VALUES (:name,:telephone,:mobile,:email)"); //to insert data in the table
        try {
            $conn->beginTransaction();
            $insert_query->bindParam(":name", $name);
            $insert_query->bindParam(":telephone", $telephone);
            $insert_query->bindParam(":mobile", $mobile);
            $insert_query->bindParam(":email", $email);
            $insert_query->execute();
            if ($conn->lastInsertId() > 0) {
                header("Location: index.php?message=Record has been inserted successfully"); //success data insertion
            } else {
                header("Location: index.php?message=Failed to insert"); //failure data insertion
            }
            $conn->commit();
        }
        catch (PDOExecption $e) {
            $dbh->rollback();
            print "Error!: " . $conn->getMessage() . "</br>"; //exception
        }
    }
}
?>

update.php

<?php
include("connect.php");
$id = $_GET['id'];
$name   = "";
$telephone="";
$email  = "";
$mobile = "";
if (isset($_POST['submit'])) {
    $name         = filter_var($_POST['name'], FILTER_SANITIZE_STRING); // to filter string
    $telephone    = filter_var($_POST['telephone'], FILTER_SANITIZE_EMAIL); // to filter email
    $email        = filter_var($_POST['email'], FILTER_SANITIZE_EMAIL); // to filter email
    $mobile       = filter_var($_POST['mobile'], FILTER_SANITIZE_NUMBER_INT); // to filter number
    $check_mobile = $conn->prepare("select * from crud where mobile = '" . $mobile . "' and id not in ('".$id."')"); // to check duplicate
    $check_mobile->execute();
    if ($check_mobile->rowCount() > 0) {
        header("Location: index.php?message=Duplicate entry");
    } else {
        $insert_query = $conn->prepare("update crud set name = :name, telephone=:telephone, email=:email, mobile=:mobile where id = :id"); //to insert data
        try {
            $conn->beginTransaction();
            $insert_query->bindParam(":name", $name);
            $insert_query->bindParam(":telephone", $telephone);
            $insert_query->bindParam(":email", $email);
            $insert_query->bindParam(":mobile", $mobile);
			$insert_query->bindParam(":id", $id);
            $count = $insert_query->execute();
			
            if ($count> 0) {
                header("Location: edit.php?id=$id&message=Record has been updated successfully"); //success data insertion
                header("location:index.php");
            } else {
                header("Location: index.php?id=$id&message=Failed to update"); //failure data insertion
            }
            $conn->commit();
        }
        catch (PDOExecption $e) {
            $dbh->rollback();
            print "Error!: " . $conn->getMessage() . "</br>"; //exception
        }
    }
}
?>

edit.php

<?php 
include("connect.php");
$id = $_GET['id'];
$get_data = $conn->prepare("select * from crud where id = :id");
$get_data->bindParam(":id",$id);
$get_data->execute();
?>
<!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>CRUD using PDO in PHP and MySQL</title>
</head>

<body>
<h2>Update Record in the Databae</h2>
<?php if($get_data->rowCount()>0){ 
$result = $get_data->fetch(PDO::FETCH_ASSOC);
?>
<form action="update.php?id=<?php echo $id; ?>" method="post" enctype="application/x-www-form-urlencoded">
<label>Name</label>
<input type="text" name="name" required="required" value="<?php  if(isset($result['name'])){ echo $result['name']; } ?>" /><br /><br />
<label>Telephone Number</label>
<input type="text" name="telephone" required="required" value="<?php  if(isset($result['telephone'])){ echo $result['telephone']; } ?>" /><br /><br />
<label>Mobile Number</label>
<input type="text" name="mobile" required="required" value="<?php  if(isset($result['mobile'])){ echo $result['mobile']; } ?>" /><br /><br />

<label>Email Address</label>
<input type="email" name="email" required="required" value="<?php  if(isset($result['email'])){ echo $result['email']; } ?>" /><br /><br />

<input type="submit" name="submit" required="required" value="submit" />
</form>
<?php } else { 
echo "Invalid Request";
} ?>
<script type="text/javascript">
<?php if($_GET['message']){ ?>
alert('<?php echo $_GET['message'];?>');
<?php } ?>
</script>
</body>
</html>

index.php

<?php 
include("connect.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>CRUD using PDO in PHP and MySQL</title>
</head>

<body>
	<h2>CRUD using PDO in PHP and MySQL</h2>
<h4>Add Record in the Database</h4>
<form action="create.php" method="post" enctype="application/x-www-form-urlencoded">
<label>Name</label>
<input type="text" name="name"   size=50  required="required" /><br /><br />
<label>Telephone Number</label>
<input type="text" name="telephone"  size=50  required="required" /><br /><br />
<label>Mobile Number</label>
<input type="text" name="mobile"   size=50  required="required" /><br /><br />

<label>Email Address</label>
<input type="email" name="email"  size=50 required="required" /><br /><br />

<input type="submit" name="submit" required="required" value="submit" />
</form><br><br>
<table border="1" width="900px" >
<tr>
<th>ID No.</th>
<th>Name</th>
<th>Telephone Number</th>
<th>Email Address</th>
<th>Mobile</th>
<th>Action</th>
</tr>
<?php 
$get_datas = $conn->prepare("SELECT * FROM crud");
$get_datas->execute();
if($get_datas->rowCount()>0){
$i=1;
while($res=$get_datas->fetch(PDO::FETCH_ASSOC)){
?>
<tr>
<td align="center"><?php echo $i++; ?></td>
<td align="center"><?php echo $res['name']; ?></td>
<td align="center"><?php echo $res['telephone']; ?></td>
<td align="center"><?php echo $res['mobile']; ?></td>
<td align="center"><?php echo $res['email']; ?></td>
<td><a href="edit.php?id=<?php echo $res['id'];?>">Edit</a><br /><a href="delete.php?id=<?php echo $res['id'];?>">Delete</a></td>
</tr>
<?php } }else{
echo "<tr><td colspan='5'>Records not found</td></tr>";
} ?>
</table>
<script type="text/javascript">
<?php if($_GET['message']){ ?>
alert('<?php echo $_GET['message'];?>');
<?php } ?>
</script>
</body>
</html>

delete.php

<?php
include("connect.php");
if (isset($_GET['id'])) {
    $id = $_GET['id'];
    $checkid = $conn->prepare("select * from crud where id = '" . $id . "'"); // to check id
    $checkid->execute();
    if ($checkid->rowCount() > 0) {
		$insert_query = $conn->prepare("delete from crud where id = :id"); //to insert data
        try {
            $conn->beginTransaction();
			$insert_query->bindParam(":id", $id);
            $count = $insert_query->execute();
			
            if ($count> 0) {
                header("Location: index.php?message=Record has been Deleted successfully"); //success data insertion
            } else {
                header("Location: index.php?message=Failed to Delete"); //failure data insertion
            }
            $conn->commit();
        }
        catch (PDOExecption $e) {
            $dbh->rollback();
            print "Error!: " . $conn->getMessage() . "</br>"; //exception
        }
        
    } else {
        header("Location: index.php?message=Invalid Request");
    }
}
?>

Download the Complete Source Code Here

connect.php

 <?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "crud_pdo;
";

try {
    $conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
    $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    }
catch(PDOException $e)
    {
    echo "Connection failed: " . $e->getMessage();
    }
?>
Categories
PHP

Square Root a Number in PHP

In this tutorial, I will show how to write a PHP program that will ask the user to give a number and then the program will convert the given number to its square equivalent.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following [email protected], [email protected], and [email protected]

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod City I also accepting computer repair, networking, and Arduino Project development at a very affordable price. My website is www.jakerpomperada.blogspot.com and www.jakerpomperada.com

If you like this video please click the LIKE button,SHARE, and SUBSCRIBE to my channel.

Your support on my channel is highly appreciated.

Thank you very much.

Program Listing

<html>
  <head> 
   <title>Square Root Number in PHP </title>
  </head>
  <body> 
      <style type="text/css">
      
      body {
        font-family: arial;
            size: 12px;
      };

        </style>
    <?php
 
     $num_values = $_POST['num_val'];

  
   if(isset($_POST['submit'])) {
                  
      $square_root = sqrt($num_values);

      $results ="The Square Root number
       equivalent of $num_values is $square_root.";
    }

 if(isset($_POST['clear'])) {
      $num_values = "";
      $results = "";
    }
?>

  <h2> Square Root a Number in PHP </h2>
  <p> Mr. Jake Rodriguez Pomperada,MAED-IT, MIT </p>
<form method="post">
   <p>Give a Number <input 
    type="numeric" name="num_val"
     value="<?php echo $num_values; ?>" autofocus required /></p>
      
<input type="submit" name="submit" 
   title="Click here to compute the square value. "
   value="Submit" />
   
    &nbsp;&nbsp;&nbsp;
    <input type="submit" name="clear" 
    title="Click here to clear the textbox."
    value="Clear" />
</form>

<?php
   echo $results;
?>
</body>
</html>
Categories
PHP

Square a Number in PHP

  In this tutorial, I will show how to write a PHP program that will ask the user to give a number and then the program will convert the given number to its square number equivalent.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following [email protected], [email protected], and [email protected]

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod City I also accepting computer repair, networking, and Arduino Project development at a very affordable price. My website is www.jakerpomperada.blogspot.com and www.jakerpomperada.com

If you like this video please click the LIKE button SHARE, and SUBSCRIBE to my channel.

Your support on my channel is highly appreciated.

Thank you very much. 

Program Listing

<html>
  <head> 
   <title>Square a Number in PHP </title>
  </head>
  <body> 
      <style type="text/css">
      
      body {
        font-family: arial;
            size: 12px;
      };

        </style>
    <?php
 
     $num_values = $_POST['num_val'];

  
   if(isset($_POST['submit'])) {
                  
      $square = ($num_values * $num_values);

      $results ="The square number
       equivalent of $num_values is $square.";
       
      }

 if(isset($_POST['clear'])) {
      $num_values = "";
      $results = "";
    }
?>

  <h2> Square a Number in PHP </h2>
  <p> Mr. Jake Rodriguez Pomperada,MAED-IT, MIT </p>
<form method="post">
   <p>Give a Number <input 
    type="numeric" name="num_val"
     value="<?php echo $num_values; ?>" autofocus required /></p>
      
<input type="submit" name="submit" 
   title="Click here to compute the square value. "
   value="Submit" />
   
    &nbsp;&nbsp;&nbsp;
    <input type="submit" name="clear" 
    title="Click here to clear the textbox."
    value="Clear" />
</form>

<?php
   echo $results;
?>
</body>
</html>
Categories
PHP

Finding the Smallest Number in PHP

  In this tutorial, I will show you how to write a program to ask the user to give three numbers, and then the program will determine which of three numbers is the smallest value using PHP programming language.

 I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following [email protected], [email protected], and [email protected]

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod City I also accepting computer repair, networking, and Arduino Project development at a very affordable price. My website is www.jakerpomperada.blogspot.com and www.jakerpomperada.com

If you like this video please click the LIKE button, SHARE, and SUBSCRIBE to my channel.

Your support on my channel is highly appreciated.

Thank you very much.

Program Listing

<!DOCTYPE html>

<html lang="en">

<head>

     <meta charset="UTF-8">

     <meta name="viewport" content="width=device-width, initial-scale=1.0">

     <title>Finding the Smallest Number in PHP</title>



     <style>

          body {

               background: #f1f1f1;

               font-family: arial;

               size : 16px;



          }

          form {

               background-color: rgba(0, 0, 0, 0.7);

               color: #000;

               padding: 50px;

               position: absolute;

               -webkit-transform: translate(-50%, -50%);

               transform: translate(-50%, -50%);

               left: 50%;

               top: 50%;

          }

          .row {

               display: block;

               font-size: 0;

               margin-bottom: 18px;

          }

          h1,h2 {

               color: #fefefe;

               text-align: center;

               margin: 0 0 40px 0;

          }

          .row label {

               width: 180px;

               color: #fefefe;

               text-transform: uppercase;

               padding-left: 0!important;

          }

          .row input,

          .row textarea {

               background-color: #fefefe;

               width: 280px;

               color: #000000;

          }

          .row textarea {

               resize: none;

          }

          .row label,

          .row input,

          .row textarea {

               vertical-align: top;

               display: inline-block;

               border: 0;

               margin: 0;

               padding: 15px;

               font-size: 15px;

          }

          form button {

               background-color: #16222A;

               width: 250px;

               display: inline-block;

               border: 0;

               padding: 15px;

               color: #fefefe;

               font-size: 15px;

               text-transform: uppercase;

               cursor: pointer;

          }

          form #btnClear {

               background-color: #486980;

          }

          input:focus,

          select:focus,

          textarea:focus,

          button:focus {

               outline: none;

          }

     </style>

</head>

<body>

     <?php

    error_reporting(0);


     $num1 = $_POST['txtFirstNum'];

     $num2 = $_POST['txtSecondNum'];

     $num3 = $_POST['txtThirdNum'];
    

  function smallest($x, $y, $z) {
    $min = $x;
    if ($x <= $y && $x <= $z)
      {$min = $x;}
    if ($y <= $x && $y <= $z)
      {$min = $y;}
    if ($z <= $x && $z <= $y)
      {$min = $z;}
    $check =  $min;
    return ($check);
  }

    if(isset($_POST['submit'])) {

              
       $results = smallest($num1,$num2,$num3);             

      }



     if(isset($_POST['clear'])) {

       $num1 = "";
       $num2 = "";
       $num3 = "";
       $result = "";
  

      }

    

    ?>  



     <form action="" method="post">

          <h1>FINDING THE SMALLEST NUMBER IN PHP</h1>

          <div class="row">

               <label for="txtFirstNum">Give First Number</label>

               <input type="text" name="txtFirstNum" 

                value="<?php echo $num1; ?>" autofocus>>

          </div>

          <div class="row">

               <label for="txtSecondNum">Give Second Number</label>

               <input type="text" name="txtSecondNum"

               value="<?php echo $num2; ?>">>

          </div>

         
      <div class="row">

               <label for="txtSecondNum">Give Third Number</label>

               <input type="text" name="txtThirdNum" 

               value="<?php echo $num3; ?>">>

          </div>

         
        <div class="row">

              <label for="txtSmallest">The Smallest Number</label>

               <input type="text" name="txtSmallest" 

               value="<?php echo $results; ?>" readonly>

          </div>

          
         
              <div classs="row">

               <button type="submit" name="submit" 

               id="btnCompute">Compute</button>

               <button type="submit" name="clear"

                id="btnClear">Clear</button>

          </div>

     </form>

</body>

</html>
Categories
PHP

Basic Math Operations in PHP

 In this tutorial I wrote this program to ask the user to give two numbers and then the program will performed addition, subtraction, multiplication, and division using PHP programming language.

 I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following [email protected], [email protected], and [email protected]

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod City I also accepting computer repair, networking, and Arduino Project development at a very affordable price. My website is www.jakerpomperada.blogspot.com and www.jakerpomperada.com

If you like this video please click the LIKE button, SHARE, and SUBSCRIBE to my channel.

Your support on my channel is highly appreciated.

Thank you very much.

Program Listing

<!DOCTYPE html>

<html lang="en">

<head>

     <meta charset="UTF-8">

     <meta name="viewport" content="width=device-width, initial-scale=1.0">

     <title>Basic Math Operations in PHP</title>



     <style>

          body {

               background: #f1f1f1;

               font-family: arial;

               size : 16px;



          }

          form {

               background-color: rgba(0, 0, 0, 0.7);

               color: #000;

               padding: 50px;

               position: absolute;

               -webkit-transform: translate(-50%, -50%);

               transform: translate(-50%, -50%);

               left: 50%;

               top: 50%;

          }

          .row {

               display: block;

               font-size: 0;

               margin-bottom: 18px;

          }

          h1,h2 {

               color: #fefefe;

               text-align: center;

               margin: 0 0 40px 0;

          }

          .row label {

               width: 180px;

               color: #fefefe;

               text-transform: uppercase;

               padding-left: 0!important;

          }

          .row input,

          .row textarea {

               background-color: #fefefe;

               width: 280px;

               color: #000000;

          }

          .row textarea {

               resize: none;

          }

          .row label,

          .row input,

          .row textarea {

               vertical-align: top;

               display: inline-block;

               border: 0;

               margin: 0;

               padding: 15px;

               font-size: 15px;

          }

          form button {

               background-color: #16222A;

               width: 250px;

               display: inline-block;

               border: 0;

               padding: 15px;

               color: #fefefe;

               font-size: 15px;

               text-transform: uppercase;

               cursor: pointer;

          }

          form #btnClear {

               background-color: #486980;

          }

          input:focus,

          select:focus,

          textarea:focus,

          button:focus {

               outline: none;

          }

     </style>

</head>

<body>

     <?php

     error_reporting(0);



     $num1 = $_POST['txtFirstNum'];

     $num2 = $_POST['txtSecondNum'];

    

    if(isset($_POST['submit'])) {

      

     $addition = ($num1 + $num2);

     $subtraction = ($num1 - $num2);

     $multiplication = ($num1 * $num2);

     $division = ($num1 / $num2);

              

      }



     if(isset($_POST['clear'])) {

       $num1 = "";

       $num2 = "";

       $addition = "";

       $subtraction = "";

       $multiplication = "";

       $division = "";

      }

    

    ?>  



     <form action="" method="post">

          <h1>Basic Math Operations in PHP</h1>

          <div class="row">

               <label for="txtFirstNum">Give First Number</label>

               <input type="text" name="txtFirstNum" id="txtFirstNum"

                value="<?php echo $num1; ?>" autofocus>>

          </div>

          <div class="row">

               <label for="txtSecondNum">Give Second Number</label>

               <input type="text" name="txtSecondNum" id="txtSecondNum"

               value="<?php echo $num2; ?>">>

          </div>

         

             

           <div class="row">



               <label for="txtAddition">Addition</label>

               <input type="text" name="txtAddition" 

               value="<?php echo $addition; ?>" readonly>

          </div>

          <div class="row">

               <label for="txtSubtraction">Subtraction</label>

               <input type="text" name="txtSubtraction" 

               value="<?php echo $subtraction; ?>" readonly>

          </div>

          <div class="row">

               <label for="txtMultipy">Multiplication</label>

               <input type="text" name="txtMultipy" "

                 value="<?php echo $multiplication; ?>" readonly>

          </div>

          <div class="row">

               <label for="txtSixthNum">Division</label>

               <input type="text" name="txtDivision" id="txtSixthNum"

               value="<?php echo $division; ?>" readonly>

          </div>

              <div classs="row">

               <button type="submit" name="submit" 

               id="btnCompute">Compute</button>

               <button type="submit" name="clear"

                id="btnClear">Clear</button>

          </div>

     </form>

</body>

</html>

Categories
PHP

Perfect Number in PHP

  In this tutorial, I will show you how to write a program to ask the user to give a number and then the program will check if  the given number is a perfect number or not  using PHP programming language.

 I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following [email protected], [email protected], and [email protected]

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod City I also accepting computer repair, networking, and Arduino Project development at a very affordable price. My website is www.jakerpomperada.blogspot.com and www.jakerpomperada.com

If you like this video please click the LIKE button, SHARE, and SUBSCRIBE to my channel.

Your support on my channel is highly appreciated.

Thank you very much.

Program Listing

<html>

  <head> 

   <title>Perfect Number in PHP </title>

  </head>

  <body> 

      <style type="text/css">

      

      body {

        font-family: arial;

            size: 12px;

      };



        </style>

    <?php

 

     $num_values = $_POST['num_val'];



  function CheckPerfect($num) {

  

  $i = 1;

  $total = 0;



  for($i=1; $i<$num; $i++)

  {

  if($num % $i == 0)

      $total += $i;

} 



  if($total == $num)

    $message = "$num is a perfect number.";

  else

    $message = "$num is not a perfect number.";

     return $message;

    }





   if(isset($_POST['submit'])) {

                  

      $results= CheckPerfect($num_values);

       

      }



 if(isset($_POST['clear'])) {

      $num_values = "";

      $results = "";

    }

?>



  <h2> Perfect Number in PHP </h2>

  <p> Mr. Jake Rodriguez Pomperada,MAED-IT, MIT </p>

<form method="post">

   <p>Give a Number <input 

    type="numeric" name="num_val"

     value="<?php echo $num_values; ?>" autofocus required /></p>

      

<input type="submit" name="submit" 

   title="Click here to compute the cube root. "

   value="Submit" />

   

    &nbsp;&nbsp;&nbsp;

    <input type="submit" name="clear" 

    title="Click here to clear the textbox."

    value="Clear" />

</form>



<?php

   echo $results;

?>

</body>

</html>
Categories
PHP

Positive and Negative Number in PHP

  In this tutorial, I will show you how to write a program to ask the user to give a number and then the program will check if the given number in positive, zero, or negative number using  PHP programming language.

 I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following [email protected], [email protected], and [email protected]

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod City I also accepting computer repair, networking, and Arduino Project development at a very affordable price. My website is www.jakerpomperada.blogspot.com and www.jakerpomperada.com 

If you like this video please click the LIKE button,

SHARE, and SUBSCRIBE to my channel.

Your support on my channel is highly appreciated.

Thank you very much.

<html>

  <head> 

   <title>Positive and Negative Number in PHP </title>

  </head>

  <body> 

      <style type="text/css">

      

      body {

        font-family: arial;

            size: 12px;

      };



        </style>

    <?php

 

     $num_values = $_POST['num_val'];



  function CheckNumber($x) {

    if ($x > 0)

      {$message = "The given number 

                 $x is a Positive number.";}

    if ($x == 0)

      {$message = "The given number 

                 $x is Zero.";}

    if ($x < 0)

      {$message = "The given number 

                 $x is a Negative number.";}

     return $message;

    }





   if(isset($_POST['submit'])) {

                  

      $results= CheckNumber($num_values);

       

      }



 if(isset($_POST['clear'])) {

      $num_values = "";

      $results = "";

    }

?>



  <h2> Positive and Negative Number in PHP </h2>

  <p> Mr. Jake Rodriguez Pomperada,MAED-IT, MIT </p>

<form method="post">

   <p>Give a Number <input 

    type="numeric" name="num_val"

     value="<?php echo $num_values; ?>" autofocus required /></p>

      

<input type="submit" name="submit" 

   title="Click here to compute the cube root. "

   value="Submit" />

   

    &nbsp;&nbsp;&nbsp;

    <input type="submit" name="clear" 

    title="Click here to clear the textbox."

    value="Clear" />

</form>



<?php

   echo $results;

?>

</body>

</html>
Categories
PHP

Addition of Six Numbers in PHP

In this  tutorial, I will show you how a program using PHP to ask the user to give six numbers and then

the program will compute the sum of six numbers given  by the user.

 I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following [email protected], [email protected], and [email protected]

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod City I also accepting computer repair, networking, and Arduino Project development at a very affordable price. My website is www.jakerpomperada.blogspot.com and www.jakerpomperada.com

If you like this video please LIKE, SHARE, and SUBSCRIBE to my channel.

Thank you very much for your support.

Program Listing

<!DOCTYPE html>
<html lang="en">
<head>
     <meta charset="UTF-8">
     <meta name="viewport" content="width=device-width, initial-scale=1.0">
     <title>Addition of Six Numbers in PHP</title>

     <style>
          body {
               background: #f1f1f1;
               font-family: arial;
               size : 16px;

          }
          form {
               background-color: rgba(0, 0, 0, 0.7);
               color: #000;
               padding: 50px;
               position: absolute;
               -webkit-transform: translate(-50%, -50%);
               transform: translate(-50%, -50%);
               left: 50%;
               top: 50%;
          }
          .row {
               display: block;
               font-size: 0;
               margin-bottom: 18px;
          }
          h1 {
               color: #fefefe;
               text-align: center;
               margin: 0 0 40px 0;
          }
          .row label {
               width: 180px;
               color: #fefefe;
               text-transform: uppercase;
               padding-left: 0!important;
          }
          .row input,
          .row textarea {
               background-color: #fefefe;
               width: 280px;
               color: #000000;
          }
          .row textarea {
               resize: none;
          }
          .row label,
          .row input,
          .row textarea {
               vertical-align: top;
               display: inline-block;
               border: 0;
               margin: 0;
               padding: 15px;
               font-size: 15px;
          }
          form button {
               background-color: #16222A;
               width: 250px;
               display: inline-block;
               border: 0;
               padding: 15px;
               color: #fefefe;
               font-size: 15px;
               text-transform: uppercase;
               cursor: pointer;
          }
          form #btnClear {
               background-color: #486980;
          }
          input:focus,
          select:focus,
          textarea:focus,
          button:focus {
               outline: none;
          }
     </style>
</head>
<body>
     <?php
     error_reporting(0);

     $num1 = $_POST['txtFirstNum'];
     $num2 = $_POST['txtSecondNum'];
     $num3 = $_POST['txtThirdNum'];
     $num4 = $_POST['txtFourthNum'];
     $num5 = $_POST['txtFifthNum'];
     $num6 = $_POST['txtSixthNum'];
    
     $result = $_POST['txtResult'];

 
   if(isset($_POST['submit'])) {
      
       $result = ($num1+$num2+$num3+$num4+$num4+$num5+$num6);
       
      }

     if(isset($_POST['clear'])) {
       $num1 = "";
       $num2 = "";
       $num3 = "";
       $num4 = "";
       $num5 = "";
       $num6 = "";
       $result="";
    }
    
    ?>  

     <form action="" method="post">
          <h1>Addition of Six Numbers in PHP</h1>
          <div class="row">
               <label for="txtFirstNum">Give First Number</label>
               <input type="text" name="txtFirstNum" id="txtFirstNum"
                value="<?php echo $num1; ?>" autofocus>>
          </div>
          <div class="row">
               <label for="txtSecondNum">Give Second Number</label>
               <input type="text" name="txtSecondNum" id="txtSecondNum"
               value="<?php echo $num2; ?>">>
          </div>
          <div class="row">
               <label for="txtThirdNum">Give Third Number</label>
               <input type="text" name="txtThirdNum" id="txtThirdNum"
               value="<?php echo $num3; ?>">>
          </div>
          <div class="row">
               <label for="txtFourthNum">Give Fourth Number</label>
               <input type="text" name="txtFourthNum" id="txtFourthNum"
               value="<?php echo $num4; ?>">>
          </div>
          <div class="row">
               <label for="txtFifthNum">Give Fifth Number</label>
               <input type="text" name="txtFifthNum" id="txtFifthNum"
                 value="<?php echo $num5; ?>">
          </div>
          <div class="row">
               <label for="txtSixthNum">Give Sixth Number</label>
               <input type="text" name="txtSixthNum" id="txtSixthNum"
               value="<?php echo $num6; ?>">
          </div>
           <div class="row">
               <label for="txtSixthNum">The Result</label>
               <input type="text" name="txtResult" id="txtResult"
               value="<?php echo $result; ?>">
          </div>
          <div classs="row">
               <button type="submit" name="submit" 
               id="btnCompute">Compute</button>
               <button type="submit" name="clear"
                id="btnClear">Clear</button>
          </div>
     </form>
</body>
</html>
Categories
PHP

Count Digits in PHP

 In this tutorial I will wrote a program that uses PHP programming language to ask the user to give a number and then the program will count the number of digits in the given number.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following [email protected], [email protected], and [email protected]

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod City I also accepting computer repair, networking, and Arduino Project development at a very affordable price. My website is www.jakerpomperada.blogspot.com and www.jakerpomperada.com

Thank you very much.

Program Listing

<html>
  <head> 
   <title> Count Digits in PHP </title>
  </head>
  <body> 
      <style type="text/css">
      
      body {
        font-family: arial;
            size: 12px;
      };

        </style>
    <?php
     $num_values = $_POST['num_val'];

 
   if(isset($_POST['submit'])) {
      
      $results = "<h4>The Number of Digits :" 
        .countDigits($num_values)."</h4>";
       
      }

 if(isset($_POST['clear'])) {
      $num_values = "";
      $results = "";
    }


function countDigits($num_val)
{
    $count = 0;
    while ($num_val != 0) 
    {
        $num_val = round($num_val / 10);
        $count=$count+1;
    }
    return $count;
}
 

?>

  <h2> Count Digits in PHP </h2>
  <p> Mr. Jake Rodriguez Pomperada,MAED-IT, MIT </p>
<form method="post">
   <p>Give a Number <input id="element" 
    type="numeric" name="num_val"
     value="<?php echo $num_values; ?>" autofocus required /></p>
      
<input type="submit" name="submit" 
   title="Click here to count the digits."
   value="Submit" />
   
    &nbsp;&nbsp;&nbsp;
    <input type="submit" name="clear" 
    title="Click here to clear the textbox."
    value="Clear" />
</form>

<?php
   echo $results;
?>
</body>
</html>