This is an article on PHP training banner. In this article you’ll learn rest of the things related to PHP Training banner. So what will be latest topic?
In previous article we have discussed about how to create simple PHP training banner, but now I’m going to discuss an advanced php training banner. In this example you have to enter two numbers and then our php training banner will find their sum.
And for this, I’m just going to create a simple HTML page first to show this example.
<html> <head> </head> <body> <form action = “sum.php” method = “post”> Enter 1st number : <input type = “text” name = “number1” size = “5”> <br /> Enter 2nd number : <input type = “text” name = “number2” size = “5”> <input type = “submit” value = “Submit”> </form> </body> </html>
How to save
Now save this html file as index.php and put this file in your web server directory or folder where you want to show this example to your users. Now write the PHP code which is given below & save it as sum.php
<?php $number1 = $_GET[‘number1’]; $number2 = $_GET[‘number2’]; $sum = $number1 + $number2; echo “Sum of your entered numbers is : $sum”; ?>
Now open this index.php file in your browser and enter any number two times. You will see the sum of the entered numbers with the PHP training banner shown below, like this.
So you can see that, I’ve used GET method in HTML form and name attribute. It’s not necessary to use this parameter of the get method, but it is more useful if you want to dynamically create your page. And then dynamically fetching data into PHP side is helpful too.. So that’s all about the PHP training banner!
I’ll come back with more example on PHP soon. So keep visiting this site.
PHP is an open-source scripting language used for web development. It is one of the most popular languages in use on the web today, powering 40 million websites. PHP stands for “hypertext preprocessor.” The language was created by Rasmus Lerdorf and Andi Gutmans in 1995, and it is an extension of their earlier work on a prototype of what later became known as Apache.