Saturday, March 11, 2017

Product of Two Numbers in PHP and AJAX

Hi there in this article I would like to share with you how to you AJAX and PHP together to accept two numbers from the user and then our program will compute the product of the two numbers. The code is written in PHP, JavaScript and AJAX. It is very simple to understand and follow. Thank you.

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.








Sample Program Output


Program Listing

index.php

<html>
<head>
<title> Product of Two Numbers Using PHP and AJAX </title>
</head>
<script language="javascript" src="ajax.js">
</script>
<body>
<style>
body {
background-color:lightgreen;
font-family:arial;
font:12px;
}
</style>
<br>
<h3> Product of Two Numbers Using PHP and AJAX</h3>
<script>
function clear_all()
{    
   document.getElementById("num1").value= "";
   document.getElementById("num2").value= "";
}
</script>
<form action="javascript:product(document.getElementById('frm'));" name="frm" id="frm">
<table>
<tr>
<td>First Value</td>
<td>&nbsp;&nbsp;&nbsp;<input id="num1" type="text" autofocus required/></td>
</tr>
<tr>
<td>Second Value</td>
<td>&nbsp;&nbsp;&nbsp;<input id="num2" type="text" required/></td>
</tr>
<tr>
<td colspan="2">
<br>
<input type="submit" name="button" value="Solve">
&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;
<input type="submit" name="button" value="Clear" onClick="clear_all();">
</td>
</tr>
</table>
</form>
<div name="txt" id="txt"></div>
</body>
</html> 

ajax.js


function product(obj)
{

var XMLHttpRequestObject=false;
if(window.XMLHttpRequest)
{
XMLHttpRequestObject=new XMLHttpRequest();
}
else if(window.ActiveXObject)
{
XMLHttpRequestObject=new ActiveXObject("Microsoft.XMLHTTP");
}

var str1= "num1=" + document.getElementById("num1").value;
var str2="&num2=" +document.getElementById("num2").value;

XMLHttpRequestObject.onreadystatechange = show;
XMLHttpRequestObject.open('POST', 'value.php', true);
XMLHttpRequestObject.setRequestHeader("Content-type", "application/x-www-form-urlencoded");

XMLHttpRequestObject.send(str1+str2);

function show()
{
if (XMLHttpRequestObject.readyState == 4)
{
if (XMLHttpRequestObject.status == 200)
{
result = XMLHttpRequestObject.responseText;
document.getElementById('txt').innerHTML = result;
}
}
}



value.php

<?php
$num1=$_POST['num1'];
$num2=$_POST['num2'];
$num3=$num1*$num2;
echo "The product of $num1 and $num2 is $num3.";
?>


Wednesday, March 8, 2017

Square Root Solver in Visual Basic 6

Hi here is a sample program that will ask the user to give a number in integer and then our program will solve for it's square root equivalent of the given number by the user. The code is very short and easy to understand for beginners that are very new in Visual Basic 6 programming. Thank you.

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.






Sample  Program Output


Program Listing


Function Square_Root_Solver(b As Integer)
Dim num As Integer
num = b
num = num ^ (1 / 2)
Label2.Caption = "The square root value of " & b & _
" is " & num & "."
End Function


Private Sub Command1_Click()
Dim a As Integer

a = Val(Text1.Text)

Call Square_Root_Solver(a)

End Sub

Private Sub Command2_Click()
Label2.Caption = ""
Text1.Text = ""
Text1.SetFocus
End Sub


Square a Number in Visual Basic 6

Hi there in this article I would like to share with you a sample program that will ask you to give a number and then it will compute the square value of the given number the code is very simple and easy to understand.  I hope it will help you understand how to use visual basic 6.

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.







Sample Program Output


Program Listing


Private Sub Command1_Click()
Dim a As Integer

a = Val(Text1.Text)
square = a * a

Label2.Caption = "The square value of " & a & _
" is " & square & "."

End Sub

Private Sub Command2_Click()
Label2.Caption = ""
Text1.Text = ""
Text1.SetFocus
End Sub




Sunday, March 5, 2017

Arrays and Pointers in C++

Hi there here is a sample program that shows you how to use one dimensional array and pointers in C++ this code I used it before in my programming class in C++ in college. The code is very short and easy to understand. Thank you.

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.



Program Listing


#include <iostream>

using namespace std;

int add(int &a,int &b, int &c, int &d)
{
    return(a+b+c+d);
}

main() {
    int val[4];
    val[0] = 2;
    val[1] = 4;
    val[2] = 6;
    val[3] = 8;

    cout << "The sum of "
       << val[0] <<  ","
      << val[1] <<  ","
      << val[2] <<  ","
      << val[3] <<  " is "
      << add(val[0],val[1],val[2],val[3])
      << ".";
      cout << "\n\n";
      system("pause");
}


Palindrome Checker in Visual Basic NET

Here is another simple program that I wrote using Visual Basic NET to ask the user to give a string and then our program will check and determine if the given string is a Palindrome or Not a Palindrome. The code is very simple and easy to understand. I hope you will learn from this one. Thank  you.

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.






Sample Program Output


Program Listing


Public Class Form1

    Public Function StrPalindrome(ByVal sSource As String) As String
        Dim s1 As String
        Dim s2 As String
        s1 = TextBox1.Text
        s2 = StrReverse(s1)
        If (s1 = s2) Then
            MessageBox.Show("The give word " & UCase(TextBox1.Text) & " is a Palindrome.")
        Else
            MessageBox.Show("The give word " & UCase(TextBox1.Text) & " is Not a Palindrome.")
        End If
    End Function


    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        End
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim str_word As String

        str_word = StrPalindrome(TextBox1.Text)
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        TextBox1.Text = ""
        TextBox1.Focus()
    End Sub
End Class



Palindrome Checker in Visual Basic 6

Here is another simple program that I wrote using Visual Basic 6 to ask the user to give a string and then our program will check and determine if the given string is a Palindrome or Not a Palindrome. The code is very simple and easy to understand. I hope you will learn from this one. Thank  you.

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.






Sample Program Output


Program Listing

Private Sub Command1_Click()
Dim str_word As String

str_word = StrPalindrome(Form1.Text1.Text)
End Sub

Private Sub Command2_Click()
End
End Sub

Private Sub Form_Load()
Form1.Show
End Sub
Public Function StrPalindrome(ByVal sSource As String) As String
    Dim l As Long, strRev As String
    Dim ab() As Byte
    ab = StrConv(sSource, vbFromUnicode)
    For l = UBound(ab) To 0 Step -1
        strRev = strRev & Chr$(ab(l))
    Next l
    If strRev = sSource Then
        MsgBox "The give word " & UCase(Text1.Text) & " is a Palindrome."
    Else
         MsgBox "The give word " & UCase(Text1.Text) & " is Not a Palindrome."
    End If
End Function



Product of Two Numbers in PHP

In this article I wrote a simple program to ask the user to give two numbers and then our program will compute the product of the two numbers given by our user using PHP. The code is very simple and easy to understand you will learn how to use HTML forms to accept and process the values from the user.

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.






Sample Program Output


Program Listing

<?php
error_reporting(0);

$a =$_POST['num1'];
$b =$_POST['num2'];

if (isset($_POST['ok']))
{
$result= $a * $b;
}

if (isset($_POST['clear']))
{
$a="";
$b="";
$result= "";
}

?>
<html><body>
<style>
body {
background-color:lightgreen;
font-family:arial;
font:12px;
}
</style>

<form action="index.php" method="post">
<h3> Product of Two Numbers in PHP </h3>
<br>
Value No. 1 : &nbsp;&nbsp;  <input name="num1" value="<?php echo $a ?>" autofocus required> <br><br>
Value No. 2 : &nbsp;&nbsp;  <input name="num2" value="<?php echo $b ?>" required>
<br><br>
Answer      : &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;  
             <input value="<?php if (isset($result)) echo $result ?>" readonly>
<br><br>
<input type="submit" name="ok" value="Ok" title="Click here to find the product.">
&nbsp;&nbsp;&nbsp;
<input type="submit" name="clear" value="Clear" title="Click here to clear the text box.">
</form>
</body></html>




User Account Information System in PHP and MySQLi

Hi guys in today's article I am glad and happy to to share with you a work of my close friend and fellow software engineer Mr. Raymil Garde he is also a practicing freelance web developer in Bacolod City, Negros Occidental, Philippines. In this program it will allow the user to store, edit and delete the user account in the database using PHP and MySQLi the code is already Object Oriented so it is very organize and easy to understand. I am honored that Mr. Garde allow us to share his work in our website. I hope you will find his work useful. Thank you.

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.






Sample Program Output






Thursday, March 2, 2017

Getline Command in C++

Hi there in this article I would like to share with you how to use getline command in C++. This program is very simple and easy to understand it will ask the users name and address and display the input data in the screen.

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.




Sample Program Output


Program Listing

#include <iostream>

using namespace std;

int main()

{
    string name, address;

    cout << "\n\n";
    cout << "Enter you name : ";
    getline(cin,name);

    cout << "Enter your home address: ";
    getline(cin,address);
    cout << "\n\n";
    cout << "Hi " << name;
    cout << "\n\n";
    cout <<"You present home address is " <<address;
    cout << "\n\n";
    cout << "\tEnd of Program";
    cout << "\n\n";
}


Wednesday, March 1, 2017

Persons Age Checker in C

In this article I would like to share with you a very simple program that teacher you how to use if - else statement in C. What does the program will do is to ask the persons age and then our program will check if the age of the person is already an adult or still a minor. I wrote this code using CodeBlocks 16.1 as my text editor and Dev C++ as my C compiler. I hope you will find my work useful. Thank you. 

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.




Sample Program Output



Program Listing

/* Persons Age Checker in C */
/* Author  : Mr. Jake R. Pomperada, MAED-IT   */
/* Date    : March 1, 2017  Wednesday         */
/* Tools   : CodeBlocks 16.1                  */
/* Country : Philippines                      */


#include <stdio.h>

int age = 0;

int main()
{
    printf("\n\n");
    printf("\t===== PERSONS AGECHECKER IN C =====");
    printf("\n\n");
    printf("What is your age : ");
    scanf("%d",&age);

    if (age >= 18 ) {
        printf("\n\n");
        printf("At the age of %d you are already an ADULT.",age);
      }

    else {
        printf("\n\n");
        printf("At the age of %d you are still a MINOR.",age);
      }
    printf("\n\n");
    printf("END OF PROGRAM");
    printf("\n\n");
}




Positive and Negative Number Checker in C

Good day in this article I would like to share with you guys a very simple program that I wrote using C as my programming language. I called this simple program positive and negative number checker in C. What program does is to ask the user to give a number and then our program will check and determines whether the given number is a positive or negative number. It uses conditional if statement to achieve the results. I am using CodeBlocks 16.1 in creating this program. I hope you will find my work useful. Thank you.

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.





Sample Program Output


Program Listing

/* Positive and Negative Number Checker in C */
/* Author  : Mr. Jake R. Pomperada, MAED-IT   */
/* Date    : March 1, 2017  Wednesday         */
/* Tools   : CodeBlocks 16.1                  */
/* Country : Philippines                      */


#include <stdio.h>

int num_value = 0;

int main()
{
    printf("\n\n");
    printf("\t===== POSITIVE AND NEGATIVE NUMBER CHECKER IN C =====");
    printf("\n\n");
    printf("Give a Number : ");
    scanf("%d",&num_value);

    if (num_value > 0 ) {
        printf("\n\n");
        printf("The given number %d is a POSITIVE NUMBER.",num_value);
      }

    else if (num_value < 0 ) {
        printf("\n\n");
        printf("The given number %d is a NEGATIVE NUMBER.",num_value);
      }
    else {
        printf("\n\n");
        printf("The given number %d is a ZERO.",num_value);
      }
    printf("\n\n");
    printf("END OF PROGRAM");
    printf("\n\n");
}