Skip to main content

Write an HTML program to design an entry form of student details and send it to store at database server like SQL, Oracle or MS Access


Write an HTML program to design an entry form of student details and send it to store at database server like SQL, Oracle or MS Access

<!DOCTYPE html>

<html>

<head>

<title>PHP insertion</title>

<link href="css/insert.css" rel="stylesheet">

</head>

<body>

<div class="maindiv">

<!--HTML Form -->

<div class="form_div">

<div class="title">

<h2>Insert Data In Database Using PHP.</h2>

</div>

<form action="insert.php" method="post">

<!-- Method can be set as POST for hiding values in URL-->

<h2>Form</h2>

<label>Name:</label>

<input class="input" name="name" type="text" value="">

<label>Email:</label>

<input class="input" name="email" type="text" value="">

<label>Contact:</label>

<input class="input" name="contact" type="text" value="">

<label>Address:</label>

<textarea cols="25" name="address" rows="5"></textarea><br>

<input class="submit" name="submit" type="submit" value="Insert">

</form>

</div>

</div>

</body>

</html>

<?php

$connection = mysql_connect("localhost", "root", ""); // Establishing

Connection with Server

$db = mysql_select_db("colleges", $connection); // Selecting Database from

Server

if(isset($_POST['submit'])){ // Fetching variables of the form which travels in

URL

$name = $_POST['name'];

$email = $_POST['email'];

$contact = $_POST['contact'];

$address = $_POST['address'];

if($name !=''||$email !=''){

//Insert Query of SQL

$query = mysql_query("insert into students(student_name, student_email,

student_contact, student_address) values ('$name', '$email', '$contact',

'$address')");

echo "<br/><br/><span>Data Inserted successfully...!!</span>";

}

else{

echo "<p>Insertion Failed <br/> Some Fields are Blank....!!</p>";

}

}

mysql_close($connection); // Closing Connection with Server

?>

Comments

Popular posts from this blog

Write a code simulating ARP /RARP protocols

   Write a code simulating ARP /RARP protocols . Aim:        To write a java program for simulating ARP/RARP protocols ALGORITHM: server 1. Create a server socket and bind it to port. 2. Listen for new connection and when a connection arrives, accept it. 3. Send server ‟ s date and time to the client. 4. Read client ‟ s IP address sent by the client. 5. Display the client details. 6. Repeat steps 2-5 until the server is terminated. 7. Close all streams. 8. Close the server socket. 9. Stop. Client 1. Create a client socket and connect it to the server ‟ s port number. 2. Retrieve its own IP address using built-in function. 3. Send its address to the server. 4. Display the date & time sent by the server. 5. Close the input and output streams. 6. Close the client socket. 7. Stop. Program Program for Address Resolutuion Protocol (ARP) using TCP Client: import java.io.*; import java.net.*; impor...

Importants Links of Leetcode

  Here are all the important discussion posts which contain brief descriptions about a topic with its problem list. Recursion:- A.   https://leetcode.com/tag/recursion/discuss/1733447/Become-Master-In-Recursion Binary Tree and Binary Search Tree:- A.   https://leetcode.com/tag/binary-tree/discuss/1212004/Binary-Trees-study-guide B.   https://leetcode.com/tag/binary-tree/discuss/1820334/Become-Master-in-Tree C.   https://leetcode.com/tag/binary-tree/discuss/1094690/Views-and-Traversal-of-binary-tree-or-Important-topics-or-Must-Read-%3A- ) Dynamic Programming:- A.   https://leetcode.com/discuss/study-guide/458695/Dynamic-Programming-Patterns B.   https://leetcode.com/tag/dynamic-programming/discuss/1437879/Dynamic-Programming-Patterns C.   https://leetcode.com/tag/dynamic-programming/discuss/662866/DP-for-Beginners-Problems-or-Patterns-or-Sample-Solutions D.   https://leetcode.com/tag/dynamic-programming/discuss/1050391/Must-do-Dynamic-programm...

The Future of Web Development: Why Next.js is Going Viral

  Are you ready to level up your web development game? Look no further than Next.js, the latest sensation in the world of web development that's taking the industry by storm. With its powerful features, flexibility, and performance optimizations, Next.js is becoming the go-to framework for building modern web applications. In this blog post, we'll explore why Next.js is going viral and how it's changing the landscape of web development. Supercharged Performance: One of the main reasons why Next.js is making waves is its superior performance capabilities. With built-in optimizations like automatic static site generation (SSG) and server-side rendering (SSR), Next.js allows you to create blazing-fast web applications that load quickly and deliver seamless user experiences. This is especially important in today's fast-paced digital world, where users demand instant gratification and have little patience for slow-loading websites. Flexibility and Scalability: Next.js provid...