Showing posts with label PHP. Show all posts

IF statement if PHP

Friday, September 02, 2011 · Posted in

How to use IF condition statement in PHP? this is one of the very common and known questions over the internet especially for who are new and willing to learn about PHP programming language. IF in PHP is not that easy as I've heard from some beginners, but do you know that if you only master how to use conditioning statement in programming no matter what programming languages it is and then can able to use it. Well, in fact this is one of the basic that a programmer must have to know and that is to know how to create conditional statement. If you want more sources, examples and tutorials about IF statement try to click the link given in this article. Thank you.

» More Articles can be found in this site. Click Here

PHP Array

Monday, August 29, 2011 · Posted in

How to use array in PHP?



This is one of the most questions that can be seen over the internet among programmers. We can't deny the fact that array is one of the easiest and fastest way in programming. PHP for array is one of the best topic and idea that a programmer must have to know. This is because, array is one of simplest and easier way to implement use system or website rather. It also enable your system to load faster and process all the data faster compare to manually declaring all variables and values. You can really appreciate array especially in big systems development. If you want to know more about PHP for array or PHP array or want some sample programs just try to click the given link in this article and you will be redirected to the site. Thank you.


» More Articles can be found in this site. Click Here

How to add two numbers using PHP

Friday, July 29, 2011 · Posted in ,

In this tutorial, we will know how to add two numbers using PHP. PHP can also perform arithmetic and can be use to solve mathematical equations. Sample problem is the given problem below which ask the user to input two numbers and get the sum of the two numbers.

Problem:
Write a program that will ask the user to input to numbers. Then the program must computer the sum of the two numbers and display.

Code:
<html>
<head>
<title>Title goes here</title>
</head>
<body>

<form action="" method="post">
<label>Enter Num1:</label>
<input type="text" name="num1" /><br>
<label>Enter Num2:</label>
<input type="text" name="num2" /><br><br>
<input type="submit" name="btn_submit" value="Add">
</form>

<?php
if(isset($_POST['btn_submit']))
{
$num1 = $_POST['num1'];
$num2 = $_POST['num2'];

$total = $num1+$num2;

echo "The total value is: ".$total;
}
?>


</body>
</html>
Explanation:

The program allow the user to input two numbers as stated on the problem above. The program provide user to input field which has a name of num1 and num2. When the user click the submit button the program will going to execute the PHP scripts below. PHP script first execute the condition if to determine whether the use had click the button or none. When the condition returns true then the following lines of code will be execute. The value from the form text field that has a name of num1 and num2 will be stored in a temporary variable which is the $num1 and $num2. Then, the next line of code wil be executed in which perform the adding of the two numbers and stored the sum in the variable named $total. To finish with the last line of script will be executed which display the total of the two numbers adn we use the variable total which contains the sum value of the two numbers. Below is the sample output from the given codes above.

Sample Output:

If there are some comments or questions about this article just CLICK THIS LINK to be redirected to the forum page.



» More Articles can be found in this site. Click Here

How to declare a variable in PHP

Thursday, July 28, 2011 · Posted in

It is one of the most common error of a programmer in PHP which is on how to declare a variable. Every programming language recquires varaiable declaration because variables are being use to store your temporary data. Sometimes programmers for got and sometimes failed to declare a variable in which it causes an error to their programs. The dollar sign symbol ($) uses to declare a variable in PHP. In other web programming language such as Coldfusion it uses double number sign (##). For PHP case $ is the only one that being use to declare a variable and no other than. Below is the sample of variable declaration and together with its output.


PHP Code:

<?php
$firstname = "John Larry Limbo";
$middlename = "Abellanosa";
$lastname = "Limbo";

echo "My firstname is: ".$firstname."<br/>";
echo "My middlename is: ".$middlename."<br/>";
echo "My lastname is: ".$lastname;
?>

Dont for get to put the php opening ang closing tags before you run the code cause it might cause an error on your program. As you notice I use dot(.) on my code. The function of this dot is to concatenate the string “ My firstname is: ” with the value of the variable $firstname and same with the other. Observe carefully the ouput below or you may try it with your own. Just send me a comment if the code does not run or it returns an error.


Sample ouput:


If there are some comments or questions about this article just CLICK THIS LINK to be redirected to the forum page.



» More Articles can be found in this site. Click Here

Moodle 2.0 Customizing - ELMS

Monday, July 25, 2011 · Posted in

During my OJT here in school, I am customizing moodle 2.0 so that we can have a new version of our elearning due to the fact that if we were going to update the old elearning we will consume more time because we have to code it again or should I say that we have to begin again with scratch. But my boss told me about the Moodle technology in which it is the easier way. Though the old version of our Elearning Management tool is Coldfusion but it is not a hindrance for not doing and using the Moodle. Below are some screenshot of the new elearning that I have made.


Shot 1 (Index Page)



Shot 2 (Login Page)


Shot 3 (Course List with enrollment key for student)

Student Management System - PHP

Wednesday, February 16, 2011 · Posted in

This is one of my new creation which is the Student Management System using the PHP language. This is our project during our System and Analysis and Design. Together with my group Ms. Shinette V. Jamora, Mr. Dave Angelo Gutierrez and myself made and design the concept of this system. Here is a sample login design of the system.



We also choose to have the mySql database to be the back-end database of the system. As of now we are trying to make the design of the system to be compatible with different types of browser including the IE8. Actually the design is currently under testing stage.
We also use jQuery in this system, CSS also and a little bit of scripting languages. In making and coding also we use our own coding standard we create a mini MVC or Model View Controller framework in order for us to make the coding more easier and faster, because we only have 2 months to finish this including already the planning, designing, data gathering, testing and debugging and then the final defense for the finale.

Home interface is being shown below:


PHP - Online Enrollment System

Thursday, March 25, 2010 · Posted in

Finally I made to graduate in our PE. 2 years I've waited for this moment. Now I am so very happy, through this I can made now to focus on some of my subjects such as the major subjects especially now that I am now in 3rd year college and it is really expected that when you came upon this level there were so many projects to be done and to be given by your instructors or teacher. But now I am focus on making my web application or should I say my ONLINE ENROLLMENT SYSTEM rather, I use the PHP or the PHP Hypertext Preprocessor language. Actually learning PHP is really fun and amazing. But in contrary I am also studying CFM or Coldfusion and also fusebok which is use for coldfusion framework to read your codes easily and more organize rather than coding it manually.

I'll show a sample output and screenshot of my system and I do hope that you will drop some comments if I do have enhance it color or etc. This is the login page.


and this is some of its functions and interfaces, actually this is the admin page which the admin has all the access of all the accounts of the employee.



Hope you will drop some comments about this system whether is there something that I have to change.
If you were interested with my post or you want me to help you even though a little in your project then just
dropped a comment and your contact email or your yahoo messenger ID.

How to use Form Select Statement in PHP

Wednesday, October 14, 2009 · Posted in ,

Using a select statement in one page is commonly use by web programmers in building web applications and websites. The sample codes below illustrates on how to use and on how to simply code Form select statement.

HTML CODE:
<html>
<head>
<title>Title goes heretitle>
head>
<body>
<form action="" method="post">
<select name="day">
<option value="Monday" selected="selected">Mondayoption>
<option value="Tuesday">Tuesdayoption>
<option value="Wednesday">Wednesdayoption>
<option value="Thursday">Thursdayoption>
<option value="Friday">Fridayoption>
<option value="Saturday">Saturdayoption>
<option value="Sunday">Sundayoption>
select>
<br/>
<br/>
<input type="submit" name="btn_submit" value="submit" />
form>
body>
html>

As you can observe from the codes above that we did not specify the form action. So this means that if we will going to run the codes above the return would only on its self because of the reason that we did not specify the action in which the form will going to pass the value after the user submit the form. Also as you can observe inside the select statement we have and option which has a value of the complete days from Monday to Sunday, as you notice I put an attribute in the first option which is selected="selected" this shows that every time that the page is being refresh or open the first option will be the select item to be seen by the user.


PHP CODE:

<html>
<head>
<title>Title goes heretitle>
head>
<body>
<form action="" method="post">
<select name="day">
<option value="Monday" selected="selected">Mondayoption>
<option value="Tuesday">Tuesdayoption>
<option value="Wednesday">Wednesdayoption>
<option value="Thursday">Thursdayoption>
<option value="Friday">Fridayoption>
<option value="Saturday">Saturdayoption>
<option value="Sunday">Sundayoption>
select>
<br/>
<br/>
<input type="submit" name="btn_submit" value="submit" />
form>

if(isset($_POST['btn_submit']))
{
echo "Today is: ".$_POST['day'];
}
?>body>
html>
OUTPUT:


Lets assume that the user select the Wednesday, so that is why, the given sample output above shown the return value as Wednesday. Because after the use select the value Wednesday and submit the form, the PHP script will now be executed and display the value the being submitted by the form. You can also try this with your own. If there are some comments or questions about this article just CLICK THIS LINK to be redirected to the forum page.

How to use HTML Form in PHP

Monday, August 17, 2009 · Posted in ,

Form is one of the most important tool in making and designing a website or web application. Through the use of form you can send any values to another page. try to observe the given sample code below.



HTML Code:




<html>

<head>

<title>Title goes heretitle>

head>

<body>



<form action="welcome.php" method="post">



<label>Name:label><input type="text" name="name"><br/>

<label>Age:label><input type="text" name="age"><br/>

<input type="submit" name="btn_submit">



form>



body>

html>



The page contains two input fields and a submit button in which it has a type of text and a name of name and age.



Sample Output 1:


and if we were going to run the code above and then this would be the output of the code that we have made above in which it has a two input fields in which this field will be use in getting the value that comes from the user and also the submit button.



HTML with PHP Code:

<html>

<head>

<title>Title goes heretitle>

head>

<body>



Welcome echo $_POST['name']; ?>.<br/>

You are echo $_POST['age']; ?> years old.



body>

html>

and this would be our another page in which it has a filename of welcome.php. As you notice that its filename is being put at the from action so that when the user click the submit button and then it pass the value the being input by the user through the use of the form and then the form will past the value the the welcome.php and will directly display the value in the page. As you notice in the code we embed the php code in the HTML code. In this code we have the opening and the closing PHP tag. The variable array $_post["name"]; and $_post["age"]; are the two variables that holds the value that came from the form and this variable also uses to display the value that being input in the form.


Sample Output 2:








How to use While Loop in PHP

Friday, July 03, 2009 · Posted in

This is a tutorial on how to use a while loop in a PHP. The output will be the same if you were going to use a for loop, the only difference is only the code itself and especially the concept of each loop and how this loop performs its action when the programmer run his/her program. Below is a sample illustration on how to code while loop in PHP.

PHP Code:

<?php
$var_x = 1;
while($var_x <= 5)
{
echo "Number: ".$var_x."<br/>";
$var_x++;
}
?>
From the given codes above as you can observe we really put the PHP opening tag and at the end also we put the PHP ending tag, so that every time we execute the program it would not return any error. Because sometimes programmers for got to put the opening and closing tags that might be the cause of some errors sometimes in a application. After the opening tag we initialized our variable with the value of one. So, now the variable $var_x has now a value of 1. Then on the next line is the while loop itself, inside the while loop we put variable again and this time we put an operator to determine of the value is less than or equal with 5 only. Next is to print the value of the variable and after is to increment our variable. The purpose of $var_x++ is to increment the value of the variable each time the loop executes until it reach the desire value which is 5. Regarding with the open and close braces you can omit it but it is mostly required especially if you are following some coding standards but it is recommended that you have to put braces for you to be able to know where does your statement starts and ends. Below is the sample output of the above code.

Sample Output:
You can try this with your own. If there are some comments or questions about this article just CLICK THIS LINK to be redirected to the forum page.

What is PHP?

Tuesday, June 30, 2009 · Posted in

PHP stand for PHP Hypertext Preprocessor. PHP also known as a recursive acronym would you want to ask why recursive? It is because recursive is an acronym in which the first letter of the first word represented but the acronym is the acronym itself.

PHP also known as an open source, server side and a HTML embedded scripting language. When we say embedded scripting language it is a language in which it is a kind of language in where HTML and PHP codes can be combined. It is a server side client, because PHP is being process in the server and not in the browser. E,g A user request a page. As you notice that when you view source the page and then only pure HTML code are you going to see, it is because PHP process first in the server and the server will only send to the user or to the client the HTML form.

Powered by Blogger.