25.09.2014 Views

ZEND PHP 5 Certification STUDY GUIDE

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Web Programming ” 99<br />

<br />

Ascending<br />

Descending<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

GET and URLs<br />

When a form is submitted using the GET method, its values are encoded directly in<br />

the query string portion of the URL. For example, if you submit the form above by<br />

entering user in the List box and choosing to sort by Name in Ascending order, the<br />

browser will call up our index.php script with the following URL:<br />

http://example.org/index.php?list=user&orderby=name&direction=asc<br />

As you can see, the data has been encoded and appended to the end of the URL for<br />

our script. In order to access the data, we must now use the $_GET superglobal array.<br />

Each argument is accessible through an array key of the same name:<br />

echo $_GET[’list’];<br />

You can create arrays by using array notation...<br />

Licensed to 482634 - Amber Barrow (itsadmin@deakin.edu.au)<br />

http://example.org/index.php?list=user&order[by]=column&order[dir]=asc<br />

..and then access them using the following syntax:<br />

echo $_GET[’order’][’by’];<br />

echo $_GET[’order’][’dir’];

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

Saved successfully!

Ooh no, something went wrong!