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

  What do you mean by sensitivity analysis how would you use

what is a sensitivity analysis? how would you use it in planning for future expansions? what role does this kind of

  Different visual basic command

Write down the visual basic command in order to Load a LVM file ( file name: Data.lvm), Delete the first 22 row , Insert a new column from 0 to last row of file with increment of 0.1 ( For example, if there are 25 rows in Data.lvm; then 25-22=3, it w..

  What is role of kcc and its relationship to rule of three

What is the role of KCC and its relationship to the rule of three? What are the different criteria that can force replication to occur? How does Active Directory handle simultaneous changes?

  Which data structure is the optimum one

When lots of inserts & deletes are involved. When you have no clue about how big the list would grow.

  Write down an event handler that automatically displays

design an ASP.NET project with Visual Studio.NET 2005. Add an aspx form to the application. Place an Image control, three RadioButton controls, a Label control, a TextBox control, and a Button control on the form. Add three images to the applicati..

  Give most popular ways today to code a database application

Embedded SQL applications tend to lack interoperatiliby. Applications might have to modified to work with other RDBMS ODBC applications do not need the explicit declaration and use of host variables.

  Make draft or a excel spreadsheet of java vs. c++

want a draft or a excel spreadsheet of Java vs. C++ and its comparisons. I want bold statements and strong related bold information.

  Benefits of ansi/tia/eia cabling standards

Discuss about the benefits of the ANSI/TIA/EIA cabling standards in detail and also explain why telecommunications managers must be familiar with them.

  Maintenance tracking application for an apartment complex

I dentify 3 variables, along with their types, that I would use in my program. Give a brief description of the variables and see if it contains any reusable components, if so, I am to mention that it does.

  Determining the vulnerability in product

Specify the ethical considerations included when the security professional contacts the vendor regarding vulnerability in their product.

  What is role base access control models

Look at the XACML operational model that is claimed to be a generic RBAC implementation. Do you agree with the last statement?

  Recommendation on the action that the company needs

Prepare a recommendation on the action that the company needs to take against the offender - Prepare a recommendation on the action that the company needs to take against the offender.

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