Skip to main content

Posts

Showing posts from March 8, 2016

Factorial Fibinicci

Factorial <center> <form action = "" method="post">     <h2>Factorial Number</h2>     <table>         <tr><td><input type="number" name="aa" /></td></tr>         <tr><td><input type="submit" name="save" value="Submit" /></td></tr>         </table> </form> </center> <?php $x=$_POST['save']; $y=$_POST['aa']; function getFactorial($y){     $fact=1;     for($i=1;$i<=$y;$i++)         $fact *=$i;     return $fact;         } if(isset($x)and($y))     {     echo 'Factorial of Number  : <strong>'.  getFactorial($y).'</strong>'; } ?> Fibinicci <?php $a=0; $b=1; for($i=0;$i<=10;$i++){     if($i==0){         $c=0;     }else{                 $c=$a+$b;         $a=$b;         $b=$c;     }         echo $c." ";

PrimeNumber

<?php $submit=$_POST['submit']; $prime=$_POST['n']; //if($n===1){ //    echo"not a prime or composite no"; //} if($prime==1){     echo"not a prime or composite no"; } for($index=2;$index<=$prime/2;$index++){         if($prime%$index===0){         $set=1;     }   } if($set){     echo $prime." is a composite number"; }else{     echo $prime." is a prime number"; } ?> <form action="#" method="post" enctype="multipart/form-data">         <table>         <tr>             <td><input type="text" name="n"></td>             <td><input type="submit" name="submit" value="submit"></td>         </tr>     </table>     </form>

FormValidation

<?php ?> <form action="valid2.php" method="post" enctype="multipart/form-data"style="background-color: pink;">         <center> <h1>Student Registration Form</h1></center>         <table align="center">         <tr>             <td>Name :</td>             <td> <input type="text" name="uname"></td>         </tr>        <tr>             <td>E_mail</td>             <td><input type="text" name="email"></td>                 </tr>         <tr>             <td>password :</td>             <td> <input type="password" name="pass"></td>         </tr>         <tr>             <td>Gender :</td>                       <td>Male<input type="radio" name="sex"&