Archive for the 'Beginners' Category
PHP Sessions
In this tutorial you’ll be covering PHP sessions. PHP sessions are more like cookies but with the difference that sessions are closed right after the connection with server is closed. But watch this screen-cast to learn in detail about them.
This tutorial is made by phpacademy.
Diving into PHP – the series
These days I found a great PHP tutorial series called “Diving into PHP”. It is made by Jeffrey Way from Theme Forest and it has 15 episodes till now. It starts from scrach and slowly builds up to advanced topics that is why it is great for PHP beginers and for advanced users.
Some resource links :
Enough with the chitchat, lets dive you in:
Downloading the Language
1st episode will teach you to install the support applications that will build the developing environment (Get the source files):
Variables
2nd episode shows you how to work with variables and using single/double quotes (Get the source files):
Passing Values From Page to Page
3rd eppisode will get you in how to pass variables from page to page using GET and POST (Get the source files):
Multiple Variables and the “foreach” Statement
4th episode continues on how to pass multiple variables from page to page you will have a review for “foreach” statement (Get the source files):
Refactoring, Arrays, and Functions – Oh My!
5th episode reviews arrays, refactoring, functions, and includes (Get the source files):
Includes
6th episode gets you into somehow more advanced topics like “include” statement (Get the source files):
Regular Expressions
7th episode will teach you how to use regular expressions with PHP. Over the course of about ten minutes, you’ll be learning about “preg_match()” and “preg_replace()” functions to validate a form. (Get the source files):
Strings
8th episode will explain to you how to use the strings. Single quotes, double quotes and a not so known concept called heredocs (Get the source files):
Detecting First-Time Visitors
Starting with 9th episode, you’ll going to learn some practical uses of PHP. In this episode, you’ll be shown how to detect whether or not a user has visited your site previously (Get the source files):
Getting Started With MySql
In 10th episodes you’ll be shown how easy it is to get up and running with MySql. We’ll also review the correct way to retrieve information from your new database (Get the source files):
SQL Insert Statements
Continuing on from Day 10, you’ll review SQL insert statements that will allow you to add new rows to your MySql database with PHP. Additionally, you’ll learn one of the ways to loop through an array and thats the foreach statement. (Get the source files)
Thats it for the moment. Stay tuned for the upcoming screen cast. Don’t forget that screen casts are originated from http://blog.themeforest.net/tutorials/diving-into-php-video-series/.
Switches and the Ternary Operator
I know for sure that every programmer came at least once into a quite a nasty problem and that is “What the hell have I coded here ?”. We all use the IF…ELSE statements and we all get sometimes into very big codes where you don’t understand a thing. In this tutorial you will learn about the SWITCH statement and the TERNARY operator witch are very helpful in this cases. Enjoy!
Dreamweaver – making an email sending form
For this tutorial you will need some files found at http://www.tutvid.com/downloads.html. You will learn to build an email handling PHP script that sends info from your on line form to your e-mail. For this you will need any version of Dreamweaver.
PHP calculator
This is a very interesting tutorial if you would like to build your own calculator written in PHP. It guides you through all the steps and it is very clean written and has a good error checking. It uses if, witch and other math functions.
And … from users recommendation I have inserted the php code used in the video:
<?php
if ( !$_POST['submit'] ) {
echo "<table border=\"0\" cellspacing=\"3\" cellpadding=\"3\">\n";
echo "<form method=\"post\" action=\"calc.php\">\n";
echo "<tr><td><input type=\"text\" name=\"num1\"/></td>\n";
echo "<td><select name=\"sign\"><option value=\"plus\">+</option>\n<option value=\"minus\">-</option>\n<option value=\"multi\">*</option>\n<option value=\"divide\">/</option></select></td>\n";
echo "<td><input type=\"text\" name=\"num2\"/></td>\n";
echo "<td><input type=\"submit\" name=\"submit\" value=\"Calculate\"/></td></tr>\n";
echo "</form></table>\n";
} else {
$num1 = $_POST['num1'];
$num2 = $_POST['num2'];
$sign = $_POST['sign'];
$errors = array();
$signs = array('plus', 'minus', 'multi', 'divide');
if (!$num1) {
$errors[] = "You did not supplied the first number";
} else {
if (!$num2) {
$errors[] = "You did not supplied the second number";
} else {
if(!$sign) {
$errors[] = "You did not supplied a sign to calculate your two numbers";
} else {
if (!in_array($sign, $signs)) {
$errors[] = "Invalid sign for calculation";
} else {
if($sign == "divide") {
if ($num2 == 0) {
$errors[] = "You cannot divide by 0. Please choose a different number to divide with";
}
}
if (!is_numeric($num1)) {
$errors[] = "Your first number is not numeric";
} else {
if (!is_numeric($num2)) {
$errors[] = "Your second number is not numeric";
}
}
}
}
}
}
if (count($errors)>0) {
echo "The fallowing errors occurred:<br>\n";
foreach ($errors as $error) {
echo $error."<br>\n";
}
} else {
switch ($sign) {
case 'plus':
$equation = $num1 + $num2;
$written = $num1 . " + " . $num2;
break;
case 'minus':
$equation = $num1 - $num2;
$written = $num1 . " - " . $num2;
break;
case 'multi':
$equation = $num1 * $num2;
$written = $num1 . " * " . $num2;
break;
case 'divide':
$equation = $num1 / $num2;
$written = $num1 . " / " . $num2;
break;
default :
$equation = "";
$written = "";
break;
}
echo $written . " = " . $equation;
}
}
?>
How to create a database
PHP – Server side vs. client side
I think this should have been the first tutorials posted on VideoPHPBlog.com. In this video php tutorial you will be explained the basics of what the web server is doing when it receives a web page request and the difference between server side and client side programing.
By the way … very good job done by http://www.idea22.com.





