Archive for the 'Forms' Category

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; 
	}
}
</pre>

Drag And Drop Made Easy: Tutorial - Ajax And PHP Part Two

This is the second part of Drag And Drop Made Easy tutorial. To see the first part click here.

Drag And Drop Made Easy With Ajax And PHP - Part One

Every body likes the ease of Drag and Drop thinks in Windows. It saves a lot of time when you need to do a lot of things (like copying some pictures from one folder to another). But what if we do this in a web site. This tutorial will show us how to do this easy.

Send Emails with a Web Form

With this movie you will be shown how to send email by making submitting a form.

User Login and Cookies

Learning to make User Login and work with Cookies can be pretty hard some times and it is a good idea to learn the basics from the experts. This tutorial will help you learn this.

POST, Table and Forms tutorial

In this video tutorial you will learn how to create basic HTML web pages and how to create tables and process forms.