Posts

PHP Code for login authentication using File data.

Image
PHP Code: <!DOCTYPE html> <html> <head> <style> input{ width: 200px; font-size: 20px; padding: 10px; margin: 10px; } </style> </head> <body> <h3>Php Code for login authentication using File data</h2> <form method="POST"> <h2>Ragister</h2> <input type="text" name="uname" placeholder="Enter Username.." required /> <input type="password" name="pass" placeholder="Enter password.." required /> <input type="submit" value="sign up" name="signup"> <input type="submit" value="sign in" id="in" name="signin"> </form> <?php if (isset($_POST['signup'])){ $myfile = fopen("program5.txt", "w...

PHP Code to read data from txt file and display it in html table

Image
PHP Code: <!DOCTYPE html> <html> <head> <style> td{ padding: 5px; font-size: 20px; } </style> </head> <body> <h3>Php Code to read data from txt file and display it in html table</h2> <?php $myfile = fopen("program4.txt", "r") or die("Unable to open file!"); $data = fread($myfile,filesize("program4.txt")); $result = explode(',', $data); ?> <table border="1"> <tr> <td><?php echo $result[0]; ?></td> </tr> <tr> <td><?php echo $result[1]; ?></td> </tr> <tr> <td><?php echo $result[2]; fclose($myfile); ?></td> </tr> </table> </body> </html> Output:

PHP Code to print first 10 Fibonacci Numbers

Image
PHP Code: <!DOCTYPE html> <html> <body> <h3>Php Code to print first 10 Fibonacci Numbers</h2> <?php $number = 10; $i = 2; $res = 1; $last = 0; echo "<h3>Fibonacci series....</h3>"; echo "<h3>0 1 "; while($i <= $number){ $temp = $res + $last; echo $temp, " "; $last = $res; $res = $temp; $i = $i + 1; } echo "</h3>" ?> </body> </html> Output:

PHP Code to check if number is prime or not

Image
PHP Code: <!DOCTYPE html> <html> <head> <style> input{ width: 200px; font-size: 20px; padding: 10px; margin: 10px; } </style> </head> <body> <h3>Php Code to check if number is prime or not</h2> <form method="$_GET"> <input type="number" placeholder="Enter a Number.." name="number" /> <input type="submit" name="send" /> </form> <?php if (isset($_GET['send'])){ $number = $_GET['number']; $count = 0; for ($i = 1; $i <= $number; $i++){ $res = $number % $i; if ($res == 0){ $count++; } } if ($count < 3){ echo "<h3>",$number, " Number is Prime</h3>"; } el...

PHP Code to display today's date in dd-mm-yy format

Image
PHP Code: <!DOCTYPE html> <html> <body> <h3>Php Code to display today's date in dd-mm-yy format.</h2> <?php echo "<h3>dd-mm-yy</h3>"; echo "<h3>", date('d - m - Y') ,"</h3>"; ?> </body> </html> Output:

Write a program to show Fibonacci Series

Image
HTML Code Try it <!-- Write a program to show Fibonacci Series between 0 to 74. --> <body> <div class="body"> <div><input type="number" id="num1" placeholder="Enter a number...." /></div> <div><input type="button" onclick="result()" value="Submit" /></div> </div> <p id="result"></p> </body> CSS Code Try it .body{ padding: 15px; } input, select{ padding: 10px; margin: 5px; width: 300px; } p{ text-align: center; font-size: 30px; color: blue; } JavaScript Code Try it function result(){ var n = Number(document.getElementById("num1").value); var a = 0; var b = 1; var text = [0,1] document.getElementById("result").innerHTML = a; document.getElementById("result").innerHTML = b; for (i = 2;i Output Try it Try it

Write a program to find the factorial of any number

Image
HTML Code Try it <!-- Write a program to find the factorial of any number. --> <body> <div class="body"> <div><input type="number" id="num1" placeholder="Enter a number...." /></div> <div><input type="button" onclick="result()" value="Submit" /></div> </div> <p id="result"></p> </body> CSS Code Try it .body{ padding: 15px; } input, select{ padding: 10px; margin: 5px; width: 300px; } p{ text-align: center; font-size: 30px; color: blue; } JavaScript Code Try it function result(){ var n = Number(document.getElementById("num1").value); temp = 1; for(i=1;i Output Try it Try it