Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Build a php page (book-insertion.php) that displays an HTML form, prompting user

ID: 3757364 • Letter: B

Question

Build a php page (book-insertion.php) that displays an HTML form, prompting user to enter the information of a certain book. Once the information is filled in and the submit button is clicked, the information should be sent to and displayed on another php page (display-book-info.php). The book fields to be entered are: • Book Title: the title should consist of at least three words • Book ISBN number: a number that consists of exactly 10 or 13 digits • Book summary: a maximum of 300 words • Author(s): a comma-separated list of authors • publisher • publishing year: a year in the range [1300-9999] • Number of pages

Notes • The book information should be sent sing the “POST” method • Server-side validation should be conducted based on the field specifications clarified above. For example, if a user enters an ISBN number of length 9 digits, an error message appears asking for input correction. Build a php page (book-insertion.php) that displays an HTML form, prompting user to enter the information of a certain book. Once the information is filled in and the submit button is clicked, the information should be sent to and displayed on another php page (display-book-info.php). The book fields to be entered are: • Book Title: the title should consist of at least three words • Book ISBN number: a number that consists of exactly 10 or 13 digits • Book summary: a maximum of 300 words • Author(s): a comma-separated list of authors • publisher • publishing year: a year in the range [1300-9999] • Number of pages

Notes • The book information should be sent sing the “POST” method • Server-side validation should be conducted based on the field specifications clarified above. For example, if a user enters an ISBN number of length 9 digits, an error message appears asking for input correction. Build a php page (book-insertion.php) that displays an HTML form, prompting user to enter the information of a certain book. Once the information is filled in and the submit button is clicked, the information should be sent to and displayed on another php page (display-book-info.php). The book fields to be entered are: • Book Title: the title should consist of at least three words • Book ISBN number: a number that consists of exactly 10 or 13 digits • Book summary: a maximum of 300 words • Author(s): a comma-separated list of authors • publisher • publishing year: a year in the range [1300-9999] • Number of pages

Notes • The book information should be sent sing the “POST” method • Server-side validation should be conducted based on the field specifications clarified above. For example, if a user enters an ISBN number of length 9 digits, an error message appears asking for input correction.

Explanation / Answer

connect.php

<?php

$servername="localhost";
$username="root";
$password="";

$cn= mysql_connect($servername, $username, $password);

$dbname="practicals";
$db=mysql_select_db($dbname, $cn);

?>

book_insertion.php

<?php

session_start();

include("connect.php");

?>

<! DOCTYPE html>

<html>

<head>

<title> Biodata </title>

<style>

form{border:5px solid blue;align:center;width:500px;}

table{height:300px;width:500px;align:center;}

</style>

</head>

<body align="center">

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

<table>

<tr>

<td><lable>Book Title:</lable></td>

<td><input type="text" name="t1" /></td>

</tr>

<tr>

<td><lable>Book ISBN number:</lable></td>

<td><input type="number" name="n1" /></td>

</tr>

<tr>

<td><lable>Book Summary:</lable></td>

<td><textarea cols="50" size="10" name="t2"></textarea></td>

</tr>

<tr>

<td><lable>Author(s):</lable></td>

<td><input type="text" name="t3" /></td>

</tr>

<tr>

<td><lable>Publisher:</lable></td>

<td><input type="text" name="t4" /></td>

</tr>

<tr>

<td><lable>Publishing year:</lable></td>

<td><input type="text" name="t5" /></td>

</tr>

<tr>

<td><lable>Number of pages:</lable></td>

<td><input type="number" name="n2" /></td>

</tr>

<tr>

<td align="center"><input type="submit" value="Insert"/></td>

</tr>

</table>

</form>

</body>

</html>

book_insertion_code.php

<?php

include("connect.php");

$t1=$_POST['t1'];

$n1=$_POST['n1'];

$t2=$_POST['t2'];

$t3=$_POST['t3'];

$t4=$_POST['t4'];

$t5=$_POST['t5'];

$n2=$_POST['n2'];

$q="insert into book_info(title,isbn_number,summary,author(s),publisher,publishing_year,number_pages)

values('$t1','$n1','$t2','$t3','$t4','$t5','$n2')";

$rs=mysql_query($q);

print "arti - $rs";

print "<h1> record is inserted hello </h1>";

?>

display-book-info.php

<?php

session_start();

include("connect.php");

?>

<! DOCTYPE html>

<html>

<head>

<title> Biodata </title>

<style>

form{border:5px solid blue;align:center;width:500px;}

table{height:300px;width:500px;align:center;}

</style>

</head>

<body align="center">

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

<table>

<?php

$q="select * from book_info order by title";

$rs=mysql_query($q);

while($row=mysql_fetch_array($rs))

{

?>

<tr align="center">

<td> <?php print $row[1]; ?></td>

</tr>

<tr align="center">

<td> <?php print $row[2]; ?></td>

</tr>

<tr align="center">

<td> <?php print $row[3]; ?></td>

</tr>

<tr align="center">

<td> <?php print $row[4]; ?></td>

</tr>

<tr align="center">

<td> <?php print $row[5]; ?></td>

</tr>

<tr align="center">

<td> <?php print $row[6]; ?></td>

</tr>

<tr align="center">

<td> <?php print $row[7]; ?></td>

</tr>

<?php

}

?>

</table>

</form>

</body>

</html>

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote