Posts

Showing posts from February, 2022

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

Write a program to show multiplication table of any number.

Image
HTML Code Try it <!-- Write a program to show multiplication table 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); for(i=1;i "); } } Output Try it Try it

Write a program to show whether a number is prime or not?

Image
HTML Code Try it <!-- Write a program to show whether a number is prime or not? --> <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); count = 0 for(i=1;i Output Try it Try it

Write a script to check whether a number is even or odd?

Image
HTML Code Try it <!-- Write a script to check whether a number is even or odd? --> <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 x = Number(document.getElementById("num1").value); if(x%2 == 0){ document.getElementById("result").innerHTML = "Your Number is Even..."; } else{ document.getElementById("result").innerHTML = "Your Number is Odd..."; } } Outp...

Design a scientific calculator and make event for each button using scripting language

Image
HTML Code Try it <!-- Design a scientific calculator and make event for each button using scripting language.--> <body> <table> <tr> <td colspan="4"><input type="text" id="result" placeholder="0" /></td> </tr> <tr> <td><button id="C" onclick="clr()">C</button></td> <td><button id="z" onclick="def('/')">/</button></td> <td><button id="y" onclick="def('*')">*</button></td> <td><button id="x" onclick="def('-')">-</button></td> </tr> <tr> <td><button id="a" onclick="def('1')">1</button></td> <td><button id="b" onclick...

Write a script to compute, the Average and Grade of students marks.

Image
HTML Code Try it <!-- Write a script to compute, the Average and Grade of students marks --> <body> <div class="body"> <div><input type="number" id="math" placeholder="Enter Maths Marks...." /></div> <div><input type="number" id="cn" placeholder="Enter Computer Network Marks...." /></div> <div><input type="number" id="it" placeholder="Enter IT Marks...." /></div> <div><input type="number" id="wt" placeholder="Enter WT Marks...." /></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; }...

Write a program to determine greatest number of three numbers

Image
HTML Code Try it <!-- Write a program to determine greatest number of three numbers --> <body> <div class="body"> <div><input type="number" id="num1" placeholder="Enter 1st number...." /></div> <div><input type="number" id="num2" placeholder="Enter 2nd number...." /></div> <div><input type="number" id="num3" placeholder="Enter 3rd 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 x = Number(document.getEle...

Design a program to solve quadratic equations.

Image
HTML Code Try it <!-- Design a program to solve quadratic equations. --> <body> <div class="body"> <div><input type="number" id="num1" placeholder="Enter 1st number...." /></div> <div><input type="number" id="num2" placeholder="Enter 2nd number...." /></div> <div><input type="number" id="num3" placeholder="Enter 3rd 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 a = Number(document.getElementById("...

Write a program to perform following operations on two numbers input by the user: 1) Addition 2) Subtraction 3) Multiplication 4) Division.

Image
HTML Code Try it <!-- Write a program to perform following operations on two numbers input by the user: 1) Addition 2) Subtraction 3) Multiplication 4) Division. --> <body> <div class="body"> <div><input type="number" id="num1" placeholder="Enter 1st number...." /></div> <div><input type="number" id="num2" placeholder="Enter 2nd number...." /></div> <div> <select id="op"> <option value="add">Addition</option> <option value="sub">Subtraction</option> <option value="mul">Multiplication</option> <option value="div">Division</option> </select> </div> <div><input type="button" onclick="result()" value="Submit"...

Write a HTML code to create website in your college or department and create link for Tutorial of specific subject.

Image
HTML Code Try it <!-- Write a HTML code to create website in your college or department and create link for Tutorial of specific subject. --> <body> <p>---------Design Apply by Students --------</p> <h1>Name of Institute</h1> <h2>Tutorial Links: - <span>Web Technologies</span></h2> <div><a href="#">Internet Basics</a></div> <div><a href="#">Introduction To HTML</a></div> <div><a href="#">Basic Formating Tags</a></div> <div><a href="#">Types of List</a></div> <div><a href="#">Adding Graphics to HTML Documents</a></div> <div><a href="#">Tables</a></div> <div><a href="#">Linking Documents</a></div> <div><a href="#">Frames</a></div...

Write a HTML code to create a Registration Form. On submitting the form, the user should be asked to login with the new credentials.

Image
HTML Code Try it <!-- Write a HTML code to create a Registration Form. On submitting the form, the user should be asked to login with the new credentials. --> <body> <div id="sform"> <h1>Registration Form</h1> <div class="form"> <input type="text" id="name" placeholder="Enter Your Name" /> <input type="email" id="email" placeholder="Enter Your Email ID" /> <input type="text" id="uname" placeholder="Enter Your User Name" /> <input type="password" id="password" placeholder="Enter Your Password" /> <input type="button" onclick="signup()" value="Sign up" class="submit" /> <input type="button" onclick="lout()" value="Login" class="submit"...

Write a program to create a login form. On clicking the submit button, the user should get navigated to a profile page.

Image
HTML Code Try it <!-- Write a program to create a login form. On clicking the submit button, the user should get navigated to a profile page. --> <body> <div id="sform"> <h1>Login Form</h1> <div class="form"> <input type="text" id="name" placeholder="Enter Your Name" /> <input type="text" id="uname" placeholder="Enter Your User Name" /> <input type="password" id="password" placeholder="Enter Your Password" /> <input type="button" onclick="signup()" value="Submit" class="submit" /> </div> </div> <div class="page" id="res"> <div> <div> <p class="pagehead">Your Profile Page <span id="a" class="pic"><...

Design a web page and display horizontally two different web pages at a time.

Image
HTML Code Try it <!-- Design a web page and display horizontally two different web pages at a time --> <body> <iframe src="https://pimt.in/"></iframe> <iframe src="https://mk7college.com/"></iframe> </body> CSS Code Try it body{ background-color: rgba(0,0,0,0.2); } iframe{ height: 50%; width: 97%; padding: 10px; margin: 10px; box-shadow: 0px 0px 10px black; background-color: rgba(255, 255, 255); } Output Try it Try it

Design front page of a hospital with different styles

Image
HTML Code Try it <!-- Design front page of a hospital with different styles. --> <body> <table> <tr> <td colspan="7" class="heading">Mk-Hospital</td> </tr> <tr> <td class="menu"></td> <td class="menu menuc active"> <a href="hos.html">Home</a></td> <td class="menu menuc"> <a href="#">About</a></td> <td class="menu menuc"> <a href="#">Departments</a></td> <td class="menu menuc"> <a href="#">Appointment</a></td> <td class="menu menuc"> <a href="#">Contact</a></td> <td class="menu"></td> </tr> ...

Create Bio- Data of an employee.

Image
HTML Code Try it <!-- Create Bio- Data of an employee. --> <body> <div class="book"> <div> <div class="page"> <table class="table"> <tr> <th colspan="3">EMPLOYEE BIO-DATA</th> </tr> <tr> <td colspan="2"> <span class="item">Name: - </span>___________________<br /> <span class="item">Phone: - </span>___________________<br /> <span class="item">Mobile: - </span>+91 ___________________<br /> <span class="item">E-mail: - </span>___________________<br /> <span class="item">Date of Birth: - </span>DD: ___ MM: _____ YY: _______...

Divide a web page vertically and display logo of your college in left pane and logo of university in right pane.

Image
HTML Code Try it <!-- Divide a web page vertically and display logo of your college in left pane and logo of university in right pane. --> <body> <div class="split left"> <div class="centered"> <img src="https://zenprospect-production.s3.amazonaws.com/uploads/pictures/604f7bbda79c060001de3808/picture" alt="Avatar woman" /> <h2>Punjab Institute of Management and Technology Collage</h2> <p>Left Side</p> </div> </div> <div class="split right"> <div class="centered"> <img src="https://ptu.ac.in/wp-content/themes/cynic/images/classic-logo.png" alt="Avatar man" /> <h2>I. K. Gujral Punjab Technical University</h2> <p>Right side</p> </div> </div> </body> CSS Code Try it .split { height: 100%; w...

Embed Audio and Video into your web page.

Image
HTML Code Try it <!-- Embed Audio and Video into your web page. --> <body> <div class="video"> <iframe frameborder="0" src="https://www.youtube.com/embed/9SuxKAj8cGI" allowfullscreen></iframe> </div> <div class="audio"> <audio controls> <source src="test.wav" type="audio/wav" /> </audio> </div> </body> CSS Code Try it table{ padding: 20px; } .video iframe{ border: 2px solid black; width: 500px; height: 300px; } .audio audio{ border: 2px solid black; } Output Try it Try it