Professional Documents
Culture Documents
Samarth Polytechnic, Belhe: Department of Computer Engineering
Samarth Polytechnic, Belhe: Department of Computer Engineering
Subject: Web Based application development using PHP. Subject code: 22619
Experiment No: 15
Theory:
1.0 Title:
Develop a simple application to - a) Enter data into database b) Retrieve and present data from database
In PHP using MYSQL data can be enter into database . Also we can retrieve and present data from database.
Basic Knowledge: Apply knowledge of basic mathematics, sciences and basic engineering to solve the
computer group related problem.
Discipline Knowledge: Apply computer programming knowledge to solve the computer group related
problems.
Experiments and practices: Plan to perform experiments and practices to use the result to solve the
computer group related problems.
Engineering tools: Apply relevant Computer programming technologies and tools with an understanding
of the limitations.
Individual and Teamwork: Function effectively as a leader and the team member in
diverse/multidisciplinary teams.
Communication: Communicate effectively in oral and written form.
5.0 Apparatus:
Program-
Index.php-
<!DOCTYPE html>
<html lang="en">
<head>
<title>GFG- Store Data</title>
</head>
<body>
<center>
<h1>Storing Form data in Database</h1>
<form action="insert.php" method="post">
<p>
<label for="firstName">First Name:</label>
<input type="text" name="first_name" id="firstName">
</p>
<p>
<label for="lastName">Last Name:</label>
<input type="text" name="last_name" id="lastName">
</p>
<p>
<label for="Gender">Gender:</label>
<input type="text" name="gender" id="Gender">
</p>
<p>
<label for="Address">Address:</label>
<input type="text" name="address" id="Address">
</p>
<p>
<label for="emailAddress">Email Address:</label>
<input type="text" name="email" id="emailAddress">
</p>
<input type="submit" value="Submit">
</form>
</center>
</body>
</html>
Insert.php-
<!DOCTYPE html>
<html>
<head>
<title>Insert Page page</title>
</head>
<body>
<center>
<?php
// servername => localhost
// username => root
// password => empty
// database name => staff
$conn = mysqli_connect("localhost", "root", "", "staff");
// Check connection
if($conn === false){
die("ERROR: Could not connect. "
. mysqli_connect_error());
}
// Taking all 5 values from the form data(input)
$first_name = $_REQUEST['first_name'];
$last_name = $_REQUEST['last_name'];
$gender = $_REQUEST['gender'];
$address = $_REQUEST['address'];
$email = $_REQUEST['email'];
if(mysqli_query($conn, $sql)){
echo "<h3>data stored in a database successfully."
. " Please browse your localhost php my admin"
. " to view the updated data</h3>";
Output-
Process Product Total Dated Sign Of
Related Related (25 M) Teacher
Grade and (15M) (10M)
Dated Signature of
Teacher