Question

In: Computer Science

PHP Review For the Programming part: 1. Where (Which directory) you store the database connecting information?...

PHP

Review

For the Programming part:

1. Where (Which directory) you store the database connecting information? parallel to htdocs folder why? no one can access except the admin

2. difference between GET and POST methods

3. Include multiple files: include, include_once, require, require_once

4. what is a sticky form?

Solutions

Expert Solution

2.

The GET Method

GET is used to request data from a specified resource.

GET is one of the most common HTTP methods.

Note that the query string (name/value pairs) is sent in the URL of a GET request:

/test/demo_form.php?name1=value1&name2=value2

Some other notes on GET requests:

  • GET requests can be cached
  • GET requests remain in the browser history
  • GET requests can be bookmarked
  • GET requests should never be used when dealing with sensitive data
  • GET requests have length restrictions
  • GET requests are only used to request data (not modify)

The POST Method

POST is used to send data to a server to create/update a resource.

The data sent to the server with POST is stored in the request body of the HTTP request:

POST /test/demo_form.php HTTP/1.1
Host: w3schools.com
name1=value1&name2=value2

POST is one of the most common HTTP methods.

Some other notes on POST requests:

  • POST requests are never cached
  • POST requests do not remain in the browser history
  • POST requests cannot be bookmarked
  • POST requests have no restrictions on data length

3.

The “include” php statement is used to include other files into a PHP file. It has two variations, include and include_once. Include_once is ignored by the PHP interpreter if the file to be included.The include statement has the following syntax

<?php
include 'file_name';
?>

The include_once statement has the following syntax

<?php
include_once 'file_name';
?>

HERE,

  • “Include/include_once” is the statement that includes file
  • “'file_name'” is the name of the file to be included.

Example : Include / Include_once

Suppose you are developing a website that contains the same navigation menu across all the pages.You can create a common header then include it in every page using the include statement Let’s see how this can be done.We will create 2 files names header.php, index.php

Below are the codes for; header.php

<a href="/index.php">Home</a>

<a href="/aboutus.php">About us</a>

<a href="/services.php">Services</a>

<a href="/contactus.php">Contact Us</a>

index.php

<?php

include 'header.php';

?>

The header page above will output PHP Require & PHP require_once The require statement has two variations, require and require_once.The require/require_once statement is used to include file.Require_once is ignored if the required file has already been added by any of the four include statements.It has the following syntax

<?php
require 'file_name';
?>
<?php
require_once 'file_name';
?>

HERE,

  • “require/require_once” is the statement that includes file
  • “'file_name'” is the name of the file to be included.

4.A sticky form is simply a standard HTML form that remembers how you filled it out. This is a particularly nice feature for end users, especially if you are requiring them to resubmit a form. With this in mind, I'll rewrite register.php one final time so that it's stickier.


Related Solutions

Part 1Write a narrative that describes what information you will store in a database. Be as...
Part 1Write a narrative that describes what information you will store in a database. Be as descriptive as you can be. Part 2Create an E-R diagram that corresponds to yournarrative. If you have fewer than three entities in your E-R diagram, revise your narrative!Remember that foreign key values should not be in your entities.Make sure that you include maximum and minimum cardinalities for your relationships.You can use a tool to create the E-R diagram or draw it by hand and...
The Active Directory database can be moved to a new location if you decide that there...
The Active Directory database can be moved to a new location if you decide that there is a need to relocate it due to space limitations. How do you accomplish this? When you back up Active Directory, what must be included? Explain the basic functions of a directory service and how Active Directory Domain Services fulfills them and describe how DNS names are formed out of domains and a hostname. # Note: No plagiarism, please
For this part, assume you are entering information about transactions into their relational database. You will...
For this part, assume you are entering information about transactions into their relational database. You will be entering financial information, but you will also need to consider the other types of information Big Marker would want to know about that event. You will also utilize what you have learned to identify internal controls specific to each transaction. The transactions are as follows: a. Billed 30 communities for monthly dues of $600 (each). b. Borrowed $10,000 from First National Bank with...
Consider Retail Store database which store the details of different items available in the store and...
Consider Retail Store database which store the details of different items available in the store and the sales of these items to different customers: Schema: Item(ItemNo, ItemName, Category, UnitPrice) Sales(SalesNo, ITemNo, SalesDate, CustomerNo, Qty) Customer(CustomerNo, CustomerName, City, Income, MobileNo) Write the following queries in Relational Algebra: a) List the No. and Name of items in ‘ABC’ category. b) Count the No. of categories from which the items were bought by the customer ‘Mohan Kumar’ c) List the customers who has...
Assume you are creating a database for IS paint store. The database needs to support the...
Assume you are creating a database for IS paint store. The database needs to support the following business functions. • Allow customers to browse the inventory. Customers want to search by paint types and colors. Customers also wants to know pricing information. • A customer can be a regular customer (e.g., home owner), or a contractor or painting professionals. Different customers can get different discounts for the same type of paint. We assume each customer can get the same discount...
Part 1: Information to use in completing is below and the requirements follow where you will...
Part 1: Information to use in completing is below and the requirements follow where you will answer the questions. Glass Company makes glass orders based on the customer specifications, so the company uses job costing to track costs. 1. The company uses direct labor hours as the cost driver for manufacturing overhead application. The company estimated the following manufacturing overhead costs for the year:   $600,000 The company estimated the following usage of direct-labor hours for the year: 200,000 2. Beginning...
C Programming- How would the whole part 1 be coded with multiple loops? Part 1: You...
C Programming- How would the whole part 1 be coded with multiple loops? Part 1: You can do A, B, and C in one program with multiple loops (not nested) or each one in a small program, it doesn’t matter. A. Create a loop that will output all the positive multiples of 9 that are less than 99. 9 18 27 36 45        …. B. Create a loop that will output all the positive numbers less than 200 that are...
Compare PHP code used to create and update two-dimensional arrays to another programming language. Which is...
Compare PHP code used to create and update two-dimensional arrays to another programming language. Which is easier and more efficient? Why? Can be compared to any other well used language.
Database design of cothing Online Shopping System. Schema represents minimal information required to store information of...
Database design of cothing Online Shopping System. Schema represents minimal information required to store information of a shop and products to sell. Cart information can be stored in session or if wish-list / watchlist is needed, the schema can be simply extended. Enjoy. SQL and methodology.
Database System Question An automobile part trading company would like to store the following attributes for...
Database System Question An automobile part trading company would like to store the following attributes for each part in a database table: PartNo: 10 bytes Name: 30 bytes UintMeasure: 5 bytes UnitCost: 4 bytes UnitPrice: 4 byes QtyOnHand: 4 bytes QtyOnOrder: 4bytes PreferredSupplier: 30 bytes Consider a disk with block size of 512 bytes and block pointer of 6 bytes long. Each record has a unique value of PartNo. There are altogether 50,000 parts in the company. Compute the following:...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT