A Web developer develops a web application that captures input data from the use
ID: 3910596 • Letter: A
Question
A Web developer develops a web application that captures input data from the user and submits same to the database. When the user clicks on the submit button the http request changes to the url below: http://localhost/mypage.php?name-Adeoye&fame; Kunle&matric; 080805010 &sex-male; a Develop an html page to capture the input from the user. The html document 1 should reflect what the developer did. (5 marks) Write a php code to submit the data to the database. Assume a database name, table name and table fields of your own. (5 marks) bExplanation / Answer
here is your answer : ------------->>>>>>>>>
<!DOCTYPE html>
<html>
<head>
<title>Input Example</title>
</head>
<style type="text/css">
p{
margin: 0;
padding-top: 5px;
padding-left: 25px;
padding-right: 25px;
padding-bottom: 25px;
}
body > header > p{
font-size: 2.1em;
text-align: center;
color:red;
}
header{
height: 50px;
background-color: silver;
}
.dci{
width: 400px;
min-height:300px;
margin: 0 auto;
background-color:magenta;
border: 2px solid;
border-radius: 5px;
}
</style>
<body>
<header>
<p> Input Example </p>
</header>
<div class="dci">
<form action="save.php" method="get">
<p>
<span>Name : - </span>
<input type="text" name="name" placeholder="Enter Your Name">
</p>
<p>
<span>Father's Name : - </span>
<input type="text" name="fname" placeholder="Enter Your Father Name">
</p>
<p>
<span>Age : - </span>
<input type="text" name="age" placeholder="Enter Your Age">
</p>
<p>
<input type="submit" name="submit" value="Submit">
</p>
</form>
</div>
</body>
</html>
save.php : --------->>>>>>>>
<?php
if(isset($_GET['submit'])){
$name = $_GET['name'];
$fname = $_GET['fname'];
$age = intval($_GET['age']);
$con = new PDO("mysql:dbname=test","users","password");
$query = "INSERT INTO info (name,fname,age) values('$name','$fname','$age');";
mysqli_query($con,$query);
mysqli_close($con);
echo '<p> Submit Succefully </p>';
}
?>
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.