php basics

Code for index1.php
              <html>
<body>
<?php
echo "hello world <br/>";
$str1 = "vinod";
$str2 = "kotiya";
echo $str1." ".$str2;
if (time()%2 == 0)
echo " <br/> Even Time is " . time();
else
echo "<br/> Odd time is " . time();

for($i=0; $i < 5 ; $i++)
echo "<br/> value of i is " . $i;

echo "<br/> Add : " . add(2,3);
function add($i,$j)
{
return $i+$j;
}

?>
<form action="index2.php" method="post">
Name : <input type="text" name="name" /><br/>
Last Name: <input type="text" name="lname" /><br/>
<input type="submit" value="send" />
</form>
                  </body>
</html>
code for index2.php


<html>
<body>
<?php
echo "your name is " . $_POST["name"];
echo "<br/> surname is " . $_POST["lname"];
?>
</body>
</html>

Comments