Create web page to be used for storing software development

Assignment Help Computer Engineering
Reference no: EM131270133

In this project, you will create a Web page that allows visitors to your site to sign a guest book that is saved to a database.

1. Create a new document in your text editor and type the

<!DOCTYPE>
declaration,
<html>
element, document head, and
<body>
element. Use the strict DTD and "Guest Book" as the
content of the
<title>
element.

2. Add the following text and elements to the document body:

<h2>Enter your name to sign our guest book</h2>
<form method="POST" action="SignGuestBook.php">
<p>First Name <input type="text" name="fi
rst_name"
/></p>
<p>Last Name <input type="text" name="last_name"
/></p>
<p><input type="submit" value="Submit" /></p>
</form>

3. Save the document as

GuestBook.html
in the Projects
directory for Chapter 8.

4. Create a new document in your text editor and type the

<!DOCTYPE>
declaration,
<html>
element, document head, and
<body>
element. Use the strict DTD and "Sign Guest Book" as the content of the
<title>
element.

5. Add the following script section to the document body:

<?php
?>

6. Add the following statements to the script section to ensure that visitors enter their first and last names:

if (empty($_POST['fi
rst_name']) || empty($_
POST['last_name']))
echo "<p>You must enter your fi
rst and last
name! Click your browser's Back button to
return to the Guest Book form.</p>";

7. Add the following statement to the script section to connect to the database. Replace Host with the host name of your MySQL server, and
User and password with the MySQL user name and password you created in Chapter 7.

else {
$DBConnect = @mysql_connect("
host
", "
user
",
"
password
");
if ($DBConnect === FALSE)
echo "<p>Unable to connect to the database
server.</p>"
. "<p>Error code " . mysql_errno()
. ": " . mysql_error() . "</p>";

8. Add the following statements to the end of the script section to create a database named Guestbook if it does not already exist:

else {
$DBName = "guestbook";
if (!@mysql_select_db($DBName, $DBConnect)) {
$SQLstring = "CREATE DATABASE $DBName";
$QueryResult = @mysql_query($SQLstring,
$DBConnect);
if ($QueryResult === FALSE)
echo "<p>Unable to execute the
query.</p>"
. "<p>Error code " . mysql_
errno($DBConnect)
. ": " . mysql_error($DBConnect)
. "</p>";
else
echo "<p>You are the first visitor!</p>";
}
mysql_select_db($DBName, $DBConnect);

9. Add the following statements to the end of the script section to create a table named Count if it does not already exist. The table consists of a single auto-incrementing primary key field named countID
$TableName = "visitors";
$SQLstring = "SHOW TABLES LIKE '$TableName'";
$QueryResult = @mysql_query($SQLstring, $DBConnect);
if (mysql_num_rows($QueryResult) == 0) {
$SQLstring = "CREATE TABLE $TableName
(countID SMALLINT
NOT NULL AUTO_INCREMENT PRIMARY KEY,
last_name VARCHAR(40), fi
rst_name VARCHAR(40))";
$QueryResult = @mysql_query($SQLstring,
$DBConnect);
if ($QueryResult
===
FALSE)
echo "<p>Unable to create the table.</p>"
. "<p>Error code " . mysql_
errno($DBConnect)
. ": " . mysql_error($DBConnect) .
"</p>";
else
echo "<p>You are the first visitor!</p>";
}
mysql_select_db($DBName, $DBConnect);

10. Add the following statements to the end of the script section to create a table named Count if it does not already exist. The table consists of a single auto-incrementing primary key field named counted .

$TableName = "visitors";
$SQLstring = "SHOW TABLES LIKE '$TableName'";
$QueryResult = @mysql_query($SQLstring, $DBConnect);
if (mysql_num_rows($QueryResult) == 0) {
$SQLstring = "CREATE TABLE $TableName
(countID SMALLINT
NOT NULL AUTO_INCREMENT PRIMARY KEY,
last_name VARCHAR(40), fi
rst_name VARCHAR(40))";
$QueryResult = @mysql_query($SQLstring,
$DBConnect);
if ($QueryResult
===
FALSE)
echo "<p>Unable to create the table.</p>"
. "<p>Error code " . mysql_
errno($DBConnect)
. ": " . mysql_error($DBConnect) .
"</p>";

11. Finally, add the following statements to the end of the script section. These mysql_query() statements add the visitor to the database. The last statement closes the database connection.

$LastName = stripslashes($_
POST['last_name']);
$FirstName = stripslashes($_
POST['fi
rst_name']);
$SQLstring = "INSERT INTO $TableName
VALUES(NULL, '$LastName',
'$FirstName')";
$QueryResult = @mysql_
query($SQLstring, $DBConnect);
if ($QueryResult === FALSE)
echo "<p>Unable to execute the query.</p>"
. "<p>Error code " . mysql_
errno($DBConnect)
. ": " . mysql_
error($DBConnect) . "</p>";
else
echo "<h1>Thank you for signing our guest book!</h1>";
}
mysql_close($DBConnect);
}
}

12. Save the document as SignGuestBook.php in the Projects directory for Chapter 8. Upload both SignGuestBook.php and GuestBook.html to the server.

13. Open GuestBook.html in your Web browser by entering the following URL:
https://<yourserver>/PHP_Projects/
Chapter.08/Projects/GuestBook.html
Test the form to see if you can add your name to the database.

14. Close your Web browser window.

Create a Web page to be used for storing software development bug reports in a MySQL database. Include fields such as product name and version, type of hardware, operating system, frequency of occurrence, and proposed solutions. Include links on the main page that allow you to create a new bug report and update an existing bug
report.

Reference no: EM131270133

Questions Cloud

Plan calls for an aggressive growth plan : The organization's strategic plan calls for an aggressive growth plan, requiring investment in facilities and equipment, growth in productivity, and labor over the next five years. It is your team's task to determine where, outside the United Stat..
Probability that doctor will spend less than 1 hour : For a particular doctor, the length of time (in hours) spent with a patient per office visit has the probability density function- What is the probability that this doctor will spend less than 1 hour with a randomly selected patient?
Evaluate the profit for this range of unit rentals : The weekly price at an extended-stay hotel (renting by the week for business travelers) is $950. Operating costs average $20,000 per week, regardless of the number of rooms rented. Construct a spreadsheet model to determine the profit if 40 rooms are..
Create web page to be used for storing software development : Create a Web page to be used for storing software development bug reports in a MySQL database. Include fields such as product name and version, type of hardware, operating system, frequency of occurrence, and proposed solutions.
Eliminating a ton of pollution for municipal energy : Suppose the cost of eliminating one ton of pollution for People's Electric is $500 and the cost of eliminating a ton of pollution for Municipal Energy is $450. What is the total cost of each utility eliminating 50 tons of pollution?
What is the delay for the following types of 64-bit adders : Assume that each two-input gate delay is 150 ps and that a full adder delay is 450 ps.
What is the probability that this doctor will spend : Illustrate Problem geometrically. Describe the geometric interpretation.- What is the probability that this doctor will spend less than 1 hour with a randomly selected patient?
How can the current distribution plan be improved : How can the current distribution plan be improved? Would the savings in costs justify changing the established relations between the Ankara-Bursa and IstanbulAntalya brewery-distributor pairs? What should be the annual cost of shipping 1 million lite..

Reviews

Write a Review

Computer Engineering Questions & Answers

  How to create a javascript program

Create a JavaScript program that declares and prints an array that contains at least 20 of your favorite songs. For each song, determine the best means for storing the year it was published.

  Questionwrite down program that computes the cost of a long

questionwrite down program that computes the cost of a long distance call. the cost of call is determined according to

  Interval coding1 for the ensemble x with alphabet a 1 2 3

interval coding1. for the ensemble x with alphabet a 1 2 3 and probabilities p 14 13 512 a evaluate the cumulative

  Produce a thresholded binary image

E27: Computer Vision Spring 2016 - PROJECT 1. Thresholding. Your system will produce a thresholded binary image where the non-zero pixels correspond to objects of interest (foreground), and the zero pixels correspond to background. You will need t..

  The cio asks you to describe why you believe it is

you are the information security officer at a medium-sized company 1500 employees. the cio asks you to explain why you

  How to generate a class diagram for the entity classes

How to generate a class diagram for the entity classes

  Define an array of type integer

CS39-Lab6 Write an assembly language program to convert the following string to uppercase using string instructions lodsb and stosb.

  How to modify bellman-ford algorithm to find and print

Show how to modify the Bellman-Ford algorithm to find and print a negative weight cycle (reachable from the source, s) in a weighted directed graph G if one exists.

  Describe what a relational database is and why relational

you are the trainer for a major technology firm. one of the problems your firm has is hiring new technologists who have

  Construct e-r diagram for a car insurance company

Construct E-R diagram for a car insurance company whose customers own one car or more cars each. Each car with it zero to any number of recorded accidents.

  What is the largest positive and smallest negative number

What is the largest positive and the smallest negative number that can be stored on this system if the storage is normalized? What bias should be used in the exponent if we prefer all exponents to be nonnegative?

  What is the importance of the program telnet

My co-worker Mark and I both regularly use our mainframe UNIX system. I've fingered him, and know that he's logged on. when I do not want to have a conversation with him, instant messenger with him, or send him an email, I would like to send him a..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd