Wednesday, September 16, 2015

Factorial Solver in Javascript

A factorial program that I wrote using JavaScript as my programming language what does the program will do is to ask the user to enter a number and then our program will compute the factorial value in a given number by the user.

If you  have some questions please send me an email at jake.r.pomperada@gmail.com and jakerpomperada@yahoo.com. My mobile number here in the Philippines is 09173084360.





Sample Program Output


Program Listing

<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Factorial Solver in Javascript</title>
</head>
<style>
body,label {
     background-color:lightgreen;
     font-family:arial;
     color:blue;
     font-size:18px;
     font-weight:bold;
     }
label{
    display: table-cell;
    text-align: right;
}
input {
  display: table-cell;
}
div.row{
    display:table-row;
}
button {
    font-family: 'arial';
    font-size:18px;
    color:red;
}
input[type="number"] { 
    font-family: 'arial';
    font-size:18px;
    color:red;
    height: 25px;
    width: 38px;
}
</style>
<body>
<h2> Factorial Solver in Javascript </h2>
 <div class="row"><label>Enter a Number</label>
      &nbsp;&nbsp;&nbsp;
      <input type="number" size="2" id="values" maxlength="2" onkeypress="return isNumber(event)" 
      required autofocus><br></div>
  <br>
<button title="Click here to find the factorial value.">Solve Factorial</button>
&nbsp;&nbsp;&nbsp;&nbsp;
<button title="Click here to clear the text box.">Clear</button><br>
<br><br>
<div id="result"></div>
<script>
var button = document.getElementsByTagName('button');

button[0].onclick = display_result;
button[1].onclick = clear_text;

document.onload = function() {
   document.getElementById('values').focus();
};
    // function to compute the factorial value of a given number.
function find_factorial_value(number_value)
{
   if (number_value < 0) {
       return -1;
   }
  
   else if (number_value == 0) {
       return 1;
   }
   
   else {
       return (number_value * find_factorial_value(number_value - 1));
   }
}

// This function will display the computed factorial results.
function display_result() {
var numbers = document.getElementById("values").value;
var result = find_factorial_value(numbers);
 
if (document.getElementById("values").value == '') {
       alert("Cannot be empty. Please put a numerical value.");
       document.getElementById('values').focus();
       
   }
else {
 document.getElementById('result').innerHTML = "The factorial value of "
        + numbers + " is " + result + ".";
}
}
// This function will clear the text box.
function clear_text() {
document.getElementById("values").value="";
document.getElementById("result").innerHTML="";
document.getElementById("values").focus();
}

// This function will only allow numerical value in the text box.
function isNumber(evt) {
    evt = (evt) ? evt : window.event;
    var charCode = (evt.which) ? evt.which : evt.keyCode;
    if (charCode > 31 && (charCode < 48 || charCode > 57)) {
        return false;
    }
    return true;
}
</script>
</body>
</html>



Kilograms To Pounds Converter in Javascript

In this article I will show you how use Javascript to convert kilograms to pounds . In the code I included a function that will only accept numeric value and not allow characters like letters and special characters. I hope you will find my work useful and beneficial in learning how to program in Javascript.

If you  have some questions please send me an email at jake.r.pomperada@gmail.com and jakerpomperada@yahoo.com. My mobile number here in the Philippines is 09173084360.






Sample Program Output


Program Listing

<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title> Kilograms To Pounds Converter in Javascript</title>
</head>
<style>
body,label {
     background-color:lightgreen;
     font-family:arial;
     color:blue;
     font-size:18px;
     font-weight:bold;
     }
label{
    display: table-cell;
    text-align: right;
}
input {
  display: table-cell;
}
div.row{
    display:table-row;
}
button {
    font-family: 'arial';
    font-size:18px;
    color:red;
}
input[type="number"] { 
    font-family: 'arial';
    font-size:18px;
    color:red;
    height: 25px;
    width: 38px;
}
</style>
<body>
<h2> Kilograms To Pounds Converter in Javascript </h2>
 <div class="row"><label>Enter a value to convert</label>
      &nbsp;&nbsp;&nbsp;
      <input type="number" size="5" id="values" maxlength="5" onkeypress="return isNumber(event)" 
      required autofocus><br></div>
  <br>
<button title="Click here to convert to pounds.">Convert To Pounds</button>
&nbsp;&nbsp;&nbsp;&nbsp;
<button title="Click here to clear the text box.">Clear</button><br>
<br><br>
<div id="result"></div>
<script>
var button = document.getElementsByTagName('button');

button[0].onclick = display_result;
button[1].onclick = clear_text;

document.onload = function() {
   document.getElementById('values').focus();
};
   // Function to convert kilogram(s) to pound(S)
function convert_to_pounds(number_value)
{
   
  return (number_value *  2.20462262 );
}

// This function will display the pounds equivalent
function display_result() {
var kilograms = document.getElementById("values").value;
var result = convert_to_pounds(kilograms);
 
if (document.getElementById("values").value == '') {
       alert("Cannot be empty. Please put a numerical value.");
       document.getElementById('values').focus();
       
   }
else {
 document.getElementById('result').innerHTML = kilograms + " kilogram(s) is equal to "
       + result.toFixed(2) + " pound(s). ";
}
}
// This function will clear the text box.
function clear_text() {
document.getElementById("values").value="";
document.getElementById("result").innerHTML="";
document.getElementById("values").focus();
}

// This function will only allow numerical value in the text box.
function isNumber(evt) {
    evt = (evt) ? evt : window.event;
    var charCode = (evt.which) ? evt.which : evt.keyCode;
    if (charCode > 31 && (charCode < 48 || charCode > 57)) {
        return false;
    }
    return true;
}
</script>
</body>
</html>


Tuesday, September 15, 2015

Reading XML File Using JSP

In this article I would like to show you how to read XML or Extensible Markup Language using JSP or Java Server Pages.  The code is quiet complex but it is not difficult as you may think. JSP is the language used in creating enterprise Java applications for the web.

If you  have some questions please send me an email at jake.r.pomperada@gmail.com and jakerpomperada@yahoo.com. My mobile number here in the Philippines is 09173084360.


Program Listing

name.xml


<people>
  <person>
    <name>Joe Zamora</name>
    <age>30</age>
  </person>
  <person>
    <name>Rob Dela Rosa</name>
    <age>29</age>
  </person>
  <person>
    <name>Ana Tan</name>
    <age>45</age>
  </person>
  <person>
    <name>Raul Smith</name>
    <age>61</age>
  </person>
<person>
    <name>Leslie Paul Adams</name>
    <age>53</age>
  </person>
</people>


read.jsp



<%@page import="org.w3c.dom.*, javax.xml.parsers.*" %>
<%
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
Document doc = docBuilder.parse("http://localhost:8080/xml_reader/name.xml");
%>
<%!
public boolean isTextNode(Node n){
return n.getNodeName().equals("#text");
}
%>

<html>
<title> Reading Users Name From XML File </title>
<head>
    
</head>
<style>
label {
      display: block;
  float: left;
  width : 250px;    
font-size:20px;
}
input, select {
                width: 200px;
                border: 2px solid #000;
                padding: 0;
                margin: 0;
                height: 30px;
                -moz-box-sizing: border-box;
                -webkit-box-sizing: border-box;
                box-sizing: border-box;
            }
            input {
                text-indent: 4px;
            }
</style>

<!--  Code for translating thai language in the web browser -->
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
  <body>
  <div class="container">
 <h3>Reading Users Name From XML File</h3>
</div>
<br><br>
<form method="post" action="read.jsp">
<label> FIRST SELECTION  </label>
<select id="select" class="select" name="filter" style="text-align:center;">
<option value="1"  ${param.filter == '1' ? 'selected' : ''}> 1st Choice</option>
<option value="2"  ${param.filter == '2' ? 'selected' : ''}> 2nd Choice</option>
<option value="3"  ${param.filter == '3' ? 'selected' : ''}> 3rd Choice</option>
<option value="4"  ${param.filter == '4' ? 'selected' : ''}> 4nd Choice</option>
</select> <br><br>
<input type="submit" id="submit" name="submit" value="OK" title="Click here to select your choice.">
</form> <br>
     
 <!--   Document doc = builder.parse("http://localhost:8080/xml_reader/users_xml/users.xml"); -->
   <%
   
   
   String option = request.getParameter("filter");  
      
    
   if("1".equals(option)){
 
%>  



 <table border='2'>
 <tr>
  <th>NAME</th>
  <th>AGE</th>
  </tr>  
 <%   Element  element = doc.getDocumentElement(); 
NodeList personNodes = element.getChildNodes();     
for (int i=0; i<personNodes.getLength(); i++){
Node emp = personNodes.item(i);
if (isTextNode(emp))
continue;
NodeList NameDOBCity = emp.getChildNodes(); 
%>
<tr>
     <%
for (int j=0; j<NameDOBCity.getLength(); j++ ){
Node node = NameDOBCity.item(j);
if ( isTextNode(node)) 
continue;
%>
<td>     <%= node.getFirstChild().getNodeValue() %></td>
<%
%>
</tr>
<%
}
%>
</table>
<% } %>
</body>   
</html>


Student Subject Grade Solver in JavaScript

In this article I would like to share with you a program that I wrote that using HTML forms, Javascript and CSS I called this program Student Subject Grade Solver in JavaScript. What does the program do is to ask the user to enter the name of the student, the subject, the prelim, midterm and endterm grade of the student and then the program will compute the average of the student. In addition the program will check and determine whether the student pass or failed in the subject by giving a remark passed or failed.

I added a function to clear the text boxes in order for a new student record to be process by our program. The code is written purely using JavaScript it is not hard as many may think. It takes a lot of learning and patience how the code works. I see to it that the code is very easy to understand and use.

If you  have some questions please send me an email at jake.r.pomperada@gmail.com and jakerpomperada@yahoo.com. My mobile number here in the Philippines is 09173084360.







Sample Program Output


Program Listing

<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Student Subject Grade Solver</title>
</head>
<style>
body {
     background-color:lightgreen;
     font-family:arial;
     color:blue;
     size:5;
     font-weight:bold;
     }
label{
    display: table-cell;
    text-align: right;
}
input {
  display: table-cell;
}
div.row{
    display:table-row;
}

</style>
<body>
<h2> Student Subject Grade Solver </h2>
 <div class="row"><label>Student Name</label>
      &nbsp;&nbsp;&nbsp;
      <input type="text" size="40" id="student_name" autofocus><br></div>
      <div class="row"><label>Subject</label>
      &nbsp;&nbsp;&nbsp;
      <input type = "text" size="30" id="subject"></div><br>
      <div class="row"><label>Prelim Grade</label>&nbsp;&nbsp;&nbsp;
      <input type="text" size="3" id="prelim_grade"></div>
      <div class="row"><label>Midterm Grade</label>&nbsp;&nbsp;&nbsp;
      <input type="text" size="3" id="midterm_grade"></div>
       <div class="row"><label>Endterm Grade</label>&nbsp;&nbsp;&nbsp;
      <input type="text" size="3" id="endterm_grade"></div>
<br>
<button title="Click here to compute the subject grade of the student.">Compute Grade</button>
&nbsp;&nbsp;&nbsp;&nbsp;
<button title="Click here to clear the text box.">Clear</button><br>
<br><br>
<div id="result1"></div>
<script>


var button = document.getElementsByTagName('button');
button[0].onclick = solve_subject_grade;
button[1].onclick = clear_text;

document.onload = function() {
document.getElementById('student_name').focus();
};


function solve_subject_grade() {
    var remarks;
    
    var student_name = document.getElementById("student_name").value;
    var subject = document.getElementById("subject").value;
    var prelim_grade = document.getElementById("prelim_grade").value;
    var midterm_grade = document.getElementById("midterm_grade").value;
    var endterm_grade = document.getElementById("endterm_grade").value;

    var final_grade =(parseInt(prelim_grade) + parseInt(midterm_grade)+ parseInt(endterm_grade))  / 3;

   if (final_grade >= 75) {
        remarks = " passed ";
    }
    if (final_grade <= 74) {
      remarks = " failed ";
    }
    if (student_name && subject && prelim_grade && midterm_grade && endterm_grade) {
        document.getElementById('result1').innerHTML = 
        student_name + " your final grade in the " +subject+ " is " +
          "<font color='red'>"+  Math.round(final_grade,0) + "</font>.<br><br>"+
         "You " + remarks + " the subject.";
    } else {
        document.getElementById('result1').innerHTML = "Kindly check first your input values."
    }
}


function clear_text() {
document.getElementById("student_name").value="";
document.getElementById("subject").value="";
document.getElementById("prelim_grade").value="";
document.getElementById("midterm_grade").value="";
        document.getElementById("endterm_grade").value="";
        document.getElementById("student_name").focus();

}
</script>
</body>
</html>




Monday, September 14, 2015

Student Information System Using OOP in PHP and MySQL



The use of computers today is very important compared than before every transactions being performed is being done using a computer.  If we are very observant enough when we to  a super market and purchase some foods when we pay for the foods he have selected the cashier uses barcode scanner and a computer with a Point of Sale program installed on it. It makes the transaction more efficient , accurate and more faster because all the information for each item be purchase is being stored in database system that can be easily retrieve and performs a series of computation needed for that particular transaction.  On the part of the supermarket the use of this can of application program Point of Sale for example is also beneficial because they can monitor the products that are saleable to the consumer and they can also perform inventory of their products more effectively this approach can save big amount of time, manpower and money to the part of the owner of the super market. It can also help them maximize losses because they can check each products they sold accurately compared to the use of manual cash register method that is prone for errors and time consuming also if they will conduct inventory of their stocks day to day.

In this article I will show you how to build a database application using PHP and MySQL but this time we will using object oriented approach in creating our database application we will using the mysqli connection in PHP and MySQL.  When I started programming in PHP and MySQL way back in 2006 most of my work in database development is using the procedural approach of programming. I will start from the top to bottom until I finish writing the application. Using this approach I was able to creating a bunch of different database applications for different customers and clients that I have. However this approach is not good if you are working with other programmers that uses object oriented approach in programming why because your code is not easy to maintain and you can’t use code libraries that is written in object oriented approach.  Basically if you ask me what are the benefits of using object oriented approach in programming basically in my own experience in Java application development the biggest advantage of OOP approach is code usability it means when we write or use the code written by other programmers it is very easy to use. Another advantage of using OOP as an approach in programming is that it is easier for us to modify and maintain the existing code that we have compared to its counterpart procedural programming. For your information object oriented programming started with the programming language called Simula a very popular programming language in Europe. To give you some idea working with object oriented programming we are dealing with objects. An object is the things that we can see in our environment it can be a thing, living things such as car, person, tools.  Every object has an attribute which refers to the physical characteristic of the a particular object for an example a car the color of the car is red, it has size, weight this is called attributes. On the other hand methods are the actions that is being performed by an object for a car is can move forward, backward and stop it means the method is an action performed by the object that is the car for instance.
The program that I will represent in this article is Students Information System using Object Oriented Approach. Before that I would like to mention that some portion of the code that I use in my program is based on the work
of my Mr. Mike Dalisay in his article about CRUD application using PHP and MySQLi here is his website http://www.codeofaninja.com he is also a fellow Filipino software developer like me.  You can visit his website to learn more about web programming.  Student Information System is a application program that I wrote in order for the school to store and manage the records of their students enrolled on their different program in their school.  The program will accept the first name, last name, course, birthday,  year and section where the student belongs and the email address that can be used by the school to contact the student. I also include an SQL dumb file for easy creation of database, table and a copy of sample records. There are still many things that you can improve this program you can all print function and login to secure your application against intruders.

The first thing that we do is to create a database connection below is a the code that will performed such operation.

db_connect.php

<?php
$db_host = "localhost";
$db_username = "root";
$db_password = "";
$db_name = "info";
$mysqli = new mysqli($db_host, $db_username, $db_password, $db_name);
if(mysqli_connect_errno()) {
                echo "Error: Could not connect to database.";
                exit;
}
?>
 In this code we use already an object oriented approach in creating an object  with this command $mysqli = new mysqli($db_host, $db_username, $db_password, $db_name);  by using the keyword new we care creating a connection of mysqli. The term mysqli mean I means improved version of mysql_connect() function in mysql. The next portion of our code is the index.php in this portion we will fetch the records from our database info and the table students to be displayed in the screen as a list of records. The user in this portion of our code has the ability to update our records or delete our records from the database.
Index.php
<html>
<head>
   <title>
  Students Information System
                </title>
<style stype="text/css">
body {
      font-size : 1.5em;
                  font-family: Arial, Helvetica, sans-serif;
                  color     : black;
                  background-image:url("sky.jpg");
}



</style>

<body>
<br>
<hr>
<font color="red">
<h2 align="center"> Students Information System </h2>
</font>
<hr>
 <?php

include 'db_connect.php';

$action = isset($_GET['action']) ? $_GET['action'] : "";


if($action=='delete'){


                $sql = "DELETE FROM students WHERE id = ?";
               

                if($stmt = $mysqli->prepare($sql)){
               
                                $stmt->bind_param("i", $_GET['id']);


                                if($stmt->execute()){
                                    echo "<br> <center>";
                                                echo "Record has been deleted. </center>";
                                               

                                                $stmt->close();
                                }else{
                                                die("Unable to delete.");
                                }
               
                }
}

$query = "select * from students";
$result = $mysqli->query( $query );

$num_results = $result->num_rows;

if( $num_results ){


                echo "<br><br>";
                echo "<table border='2' align='center'>";


                                echo "<tr>";
                                                echo "<th> <font color='red'> Firstname</th></font>";
                                                echo "<th><font color='red'> Lastname</th</font>";
                                                echo "<th><font color='red'> Course</th</font>";
                                                echo "<th><font color='red'> Birthday</th></font>";
                                                echo "<th><font color='red'>Year/Section</th></font>";
                                                echo "<th><font color='red'>Email</th></font>";
                                                echo "<th><font color='red'>Record Options</th> </font>";
                                echo "</tr>";


                while( $row = $result->fetch_assoc() ){
               
                                extract($row);


                                echo "<tr>";
                                                echo "<td> <center> {$firstname} </center></td>";
                                                echo "<td> <center> {$lastname} </center></td>";
                                                echo "<td> <center> {$course} </center></td>";
                                                echo "<td> <center> {$bday} </center></td>";
                                                echo "<td> <center>{$year_section} </center></td>";
                                                echo "<td> <center>{$email} </center></td>";
                                                echo "<td>";
                                                                echo "<a href='edit.php?id={$id}'>Update Record</a>";
                                                                echo " / ";
                                                               

                                                                echo "<a href='#' onclick='delete_user( {$id} );'>Delete Record</a>";
                                                echo "</td>";
                                echo "</tr>";
                }


                echo "</table>";

}


else{
    echo "<br><br> <center>";
                echo "No More Record(s) Found in the Database.";
                echo "</center>";
}
echo "<p align='center'><br><br>";
echo "<a href='add.php' title='Click here to add a record in the database'>
     ADD NEW RECORD</a> </p>";

$result->free();
$mysqli->close();
?>

<script type='text/javascript'>
function delete_user( id ){

                var answer = confirm('Are you sure?');

               
               
                if ( answer ){
                               
                                window.location = 'index.php?action=delete&id=' + id;
                }
}
</script>
</body>
</html>
The third portion of our code is to add a record in our table students by  the end user of our program. Kindly see the listing below there are some important comments to be read because you can understand how the mysqli works in our program.

add.php
<html>
<head>
   <title>
  Students Information System
                </title>
<style stype="text/css">
body {
      font-size : 1.5em;
                  font-family: Arial, Helvetica, sans-serif;
                  color     : black;
                  background-image:url("sky.jpg");
}



</style>



<?php
error_reporting(0);
if($_POST){


                include 'db_connect.php';
                $sql = "INSERT INTO
                                                                students (firstname, lastname, course, bday,year_section,email)
                                                VALUES
                                                                (?, ?, ?, ?, ?, ?)";

                if($stmt = $mysqli->prepare($sql) ){

                                /*
                                 * Binding of the values,
                                 * "sssssss" means 6 strings were being binded,
                                 * aside from s for string, you can also use:
                                 * i for integer
                                 * d for decimal
                                 * b for blob
                                 */
                                $stmt->bind_param(
                                                "ssssss",
                                                $_POST['firstname'],
                                                $_POST['lastname'],
                                                $_POST['course'],
                                                $_POST['bday'],
                                                $_POST['year_section'],
                                                $_POST['email']
                                );

                                                if($stmt->execute()){
                                   $message =  "<br><br> <font color='red'> <center> Student Record has been save in the database. </center>";
                                   $stmt->close();
                                }else{
                                                die(" Sorry unable to save record in the database. Please contact your Programmer.");
                                }

                }else{
                                die("Unable to prepare statement.");
                }

                                $mysqli->close();
}

?>

<center>
<br>
<hr> <font color="red">
<h2> <center> ADD STUDENT RECORDS </center> </h2>
<hr>
<body>
<form action='add.php' method='post' border='0'>
                <table border="2" align="center">
                                <tr>
                                                <td>Firstname</td>
                                                <td><input type='text' name='firstname'size="50" autofocus /></td>
                                </tr>
                                <tr>
                                                <td>Lastname</td>
                                                <td><input type='text' name='lastname' size="50" /></td>
                                </tr>
 <tr>
            <td>Course</td>
            <td><input type='text' name='course' size="50"  /></td>
        </tr>
        <tr>
            <td>Birthday</td>
            <td><input type='text' name='bday'  /></td>
        </tr>
                                <tr>
            <td>Year and Section</td>
            <td><input type='text' name='year_section'   /></td>
        </tr>
      <tr>
            <td>Email</td>
            <td><input type='text' name='email'  /></td>
        </tr>
                               

                                <td></td>
                                                <td>
                                                                <input type='submit' value='Save Record' title="Click here to save record in the database." />
                                                                <a href='index.php' title="Click here to return to the main page">Return to Main Page</a>
                                                </td>
                                 
                                 
                                 
                </table>
                 <?php echo $message; ?>
</form>
</center>

</body>
</html>

One of the things that I have learned in writing this program your variable name that can be found in your  ><input type='text' name='course' size="50"  /> just like this one must be the same in terms of variable name declaration in your table which referring to your fields. If you are not following the rules you will be surprised to find out your code is not working properly. That is one of the things to be remembered in writing an object oriented approach in programming you must be precise all the time.

The last part of our code is the edit.php which performs changing of data values from our table. After the user make some changes he or she can return to the main page of our program to see the changes that has being made. Below is the complete program listing of our edit.php.

edit.php

<html>
  <title>
     College Students Information System
                </title>
<style stype="text/css">
body {
      font-size : 1.5em;
                  font-family: Arial, Helvetica, sans-serif;
                  color     : black;
                  background-image:url("sky.jpg");
}


</style>
<body>
<?php

include 'db_connect.php';


if($_POST){


                $sql = "UPDATE
                                                                students
                                                SET
                                                                firstname = ?,
                                                                lastname = ?,
                                                                course = ?,
                                                                bday  = ?,
                                                                year_section = ?,
                                                                email = ?
                                                WHERE
                                                                id= ?";
               
                $stmt = $mysqli->prepare($sql);
               

                $stmt->bind_param(
                                'ssssssi',
                                $_POST['firstname'],
                                $_POST['lastname'],
                                $_POST['course'],
                                $_POST['bday'],
                                $_POST['year_section'],
                                $_POST['email'],
                                $_POST['id']
                );
               

                if($stmt->execute()){
                                echo "Student record is updated in the database ";
                               

                                $stmt->close();
                }else{
                                die("Sorry unable to update the record in the database");
                }
}


$sql = "SELECT
                                                id, firstname, lastname, course, bday, year_section, email 
                                FROM
                                                students
                                WHERE
                                                id = \"" . $mysqli->real_escape_string($_GET['id']) . "\"
                                LIMIT
                                                0,1";


$result = $mysqli->query( $sql );
$row = $result->fetch_assoc();
extract($row);
$result->free();
$mysqli->close();
?>


<br>
<font color="red">
<hr>
<h2> <center> UPDATE STUDENT RECORDS </center> </h2>
<hr>
 <br>
</font>
<form action='edit.php?id=<?php echo $id; ?>' method='post' border='0'>

    <table border="2" align="center">
        <tr>
            <td>Firstname</td>
            <td><input type='text' name='firstname' size="50"  autofocus value='<?php echo $firstname;  ?>' /></td>
        </tr>
        <tr>
            <td>Lastname</td>
            <td><input type='text' name='lastname' size="50" value='<?php echo $lastname;  ?>' /></td>
        </tr>
        <tr>
            <td>Course</td>
            <td><input type='text' name='course'  value='<?php echo $course;  ?>' size="50" /></td>
        </tr>
        <tr>
            <td>Birthday</td>
            <td><input type='text' name='bday'  value='<?php echo $bday;  ?>' /></td>
        </tr>
                                <tr>
            <td>Year and Section</td>
            <td><input type='text' name='year_section'  value='<?php echo $year_section;  ?>' /></td>
        </tr>
      <tr>
            <td>Email</td>
            <td><input type='text' name='email'  value='<?php echo $email;  ?>' /></td>
        </tr>
     
                               
      <td></td>
            <td>
                <input type='hidden' name='id' value='<?php echo $id ?>' />
                <input type='submit' value='Update Record' title="Click here to update the record in the datbase" />
                <a href='index.php' title="Click here to return to the main page">Return to Main Page </a>
            </td>
        </tr>
    </table>
</form>
</body>
</html>

This application program that I wrote is not very difficult is you know how to use object oriented approach in creating database application in PHP and MySQL using the mysqli connection approach. I hope you learn something out of it.  If you have some comments, suggestions and questions about this article you can email me. I am very glad to answer your questions thank you very much for always supporting this website.

Happy Productive Programming Everyone.

 If you  have some questions please send me an email at jake.r.pomperada@gmail.com and jakerpomperada@yahoo.com. My mobile number here in the Philippines is 09173084360.













Sample Program Output