Posted: September 13th, 2017

validating form data

Q1: What is validating form data?

Ans:Its a process of ensuring that user information provided is correct and in accordance with the rules provided by validation principles used in the code.Form validation normally used to occur at the server, after the client had entered all the necessary data and then pressed the Submit button. If the data entered by a client was incorrect or was simply missing, the server would have to send all the data back to the client and request that the form be resubmitted with correct information. This was really a lengthy process which used to put a lot of burden on the server.

The isset () function is used to check whether a variable is set or not. If a variable is already unset with unset() function, it will no longer be set. The isset() function return false if testing variable contains a NULL value.

 

The issest function does not check that the variable is blank and just checks whether a variable is set and not null

Q2:Give the syntax for: (a) inserting a record in a table (b) updating a record in a table (Chapter 5).

 

Ans:$sql = “INSERT INTO MyGuests (firstname, lastname, email)

VALUES (‘John’, ‘Doe’, ‘[email protected]’)”;

 

Updating a Record:

$sql = “UPDATE MyGuests SET lastname=’Doe’ WHERE id=2”;

 

 

Q3:Explain the use of hidden form inputs

Ans3:It is used for sending a value from the server to the client which is (unchanged) sent back to maintain a kind of a state.These fields should not be rendered and provide a means for servers to store state information with a form. This will be passed back to the server when the form is submitted, using the name/value pair defined by the corresponding attributes. This is a work around for the statelessness of HTTP. Another approach is to use HTTP “Cookies”.

 

Q4:What information is stored on the user’s machine using cookies and how they are set (Chapter 12)?

 

Ans4:Cookies are small files which are stored on a user’s computer. They are designed to hold a modest amount of data specific to a particular client and website, and can be accessed either by the web server or the client computer. This allows the server to deliver a page tailored to a particular user, or the page itself can contain some script which is aware of the data in the cookie and so is able to carry information from one visit to the website (or related site) to the next.Each cookie is effectively a small lookup table containing pairs of (key, data) values – for example (firstname, John) (lastname, Smith). Once the cookie has been read by the code on the server or client computer, the data can be retrieved and used to customise the web page appropriately.

 

Expert paper writers are just a few clicks away

Place an order in 3 easy steps. Takes less than 5 mins.

Calculate the price of your order

You will get a personal manager and a discount.
We'll send you the first draft for approval by at
Total price:
$0.00
Live Chat+1-631-333-0101EmailWhatsApp