test.php
<font size=20><b><pre>
<?
//print_r($GLOBALS);
//echo "$GLOBALS[HTTP_REFERER]";
/*
$a=1;
$b=1;
$c=$a+$b;
echo "$c<br>";
$a=2;
$b=2;
$c=$a+$b;
echo "$c<br>";
for($i=1;$i<=12;$i++){
echo "<hr>";
for($j=1;$j<=12;$j++){
$a=$i*$j;
echo "$i X $j = $a<br>";
}
}
*/
/*
$i=1;
for(;;){
$j=1;
for(;;){
$a=$i*$j;
echo "$i X $j = $a<br>";
if($j==12){ break;}
$j++;
}
if($i==12){ break;}
$i++;
echo "<hr>";
} */
/*
for($i=1;$i==20;$i++){
echo "$i";
}
*/
/*
$output=`dir /w`;
echo "<pre>$output</pre>";
*/
/*
$x=22;
$a=array('abc'=>"Hello","Hi","xyz"=>'$x');
echo $a['abc']; // Hello
echo "<br>";
echo $a['0']; // hi
echo "<br>";
echo $a['xyz']; // $x because single quote is escape variable
*/
/*
$a[]=20;
$a[]=220;
$a[]=30;
$a[]=50;
$a[]=10;
$a[]=70;
$a[]=90;
for($i=0;$i<=count($a);$i++){
echo $a[$i],"<br>";
}
echo "<hr>";
foreach($a as $var){
echo "$var<br>";
}
*/
$a=2;
switch($a){
case "2" : case "1":
echo "2 or 1";
break;
default:
break;
}
?>
-----------------------------------------------------
input.php
<form action="result.php" method="post">
Name : <input type="text" name="name"><br>
Lastname : <input type="text" name="lname"><br>
Nick Name : <input type="text" name="nname"><br>
Age :<input type="text" name="age"><br>
Salary :<input type="text" name="salary"><br>
Title :<input type="text" name="Title"><br>
Organization :<input type="text" name="organ"><br>
Salary :<input type="text" name="salary"><br>
Darling :<input type="text" name="darling"><br>
Favorite Food : <input type="text" name="ff"><br>
Address : <input type="text" name="address"><br>
Province : <input type="text" name="province"><br>
<input type="submit" name="submit" value="submit">
</form>
-----------------------------------------------------
function.php
<?
if($age>=18){
$result="can elect";
}else if($age<18){
$result="can't elect";
}
?>
-----------------------------------------------------
result.php
<?
$name=$_POST['name'];
$lname=$_POST['lname'];
$nname=$_POST['nname'];
$age=$_POST['age'];
$salary=$_POST['salary'];
$title=$_POST['title'];
$organ=$_POST['organ'];
$darling=$_POST['darling'];
$ff=$_POST['ff'];
$province=$_POST['province'];
include("function.php");
echo "$result<br>" ;
echo "Name : $name<br>";
echo "Lastname : $lname<br>";
echo "Nick Name : $nname<br>";
echo "Age :$age<br>";
echo "Salary :$salary<br>";
echo "Title :$Title<br>";
echo "Organization :$organ<br>";
echo "Salary :$salary<br>";
echo "Darling :$darling<br>";
echo "Favorite Food : $ff<br>";
echo "Address : $address<br>";
echo "Province : $province<br>";
?>