23.03.2017 Views

wilamowski-b-m-irwin-j-d-industrial-communication-systems-2011

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Development of Interactive Web Pages 62-7<br />

Both include() and require() functions serve the same purpose but handle errors differently. In the<br />

case of the include() function, it generates a warning and continues to execute the script whenever an<br />

error occurs. Whereas require() function generates a fatal error and terminates execution.<br />

The include() function is used especially if a block of codes are reused on multiple pages. For example,<br />

menus, headers, footers, advertisements that are reused on different pages.<br />

Example:<br />

<br />

<br />

<br />

@Copyright 2009<br />

<br />

<br />

//include("filename.php")<br />

62.3.6 $_GET and $_POST function<br />

The built-in $_GET and $_POST functions are used to collect values from an HTML/PHP form.<br />

However, both functions handle information sent from a form in different ways. Information sent from<br />

a form using the GET method is visible to everyone (all variables are displayed in the URL) and is limited<br />

to send up to 100 characters. Whereas information sent from the POST method is not visible to<br />

everyone (all variables are not displayed in the URL) and the characters are not limited.<br />

Example:<br />

<br />

Username: <br />

Password: <br />

<br />

<br />

When the user clicks the “submit” button, the form sends information attached to the URL to the<br />

server, which looks like http://www.companyname.com/Login.php?Username=Tom&Password=123<br />

And “Login.php” can use $_GET function to collect data from the form:<br />

Your username: <br />

For the same example, replace “get” with “post” under method option and the URL will look like<br />

http://www.companyname.com/Login.php<br />

And “Login.php” can use $_POST function to collect data from the form:<br />

Your username: <br />

To collect data that is sent with both the GET and POST methods, $_REQUEST function can be used i.e.,<br />

Welcome <br />

62.4 MySQL<br />

MySQL is a database system, which stores data in the form of tables. Each table is identified by a name<br />

and contains rows of data. See Table 62.1 for an example.<br />

© <strong>2011</strong> by Taylor and Francis Group, LLC

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!