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

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

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