if (isset($_GET['order'] && in_array($_GET['order'], array('Last', 'First', ...))) { $requestedOrder = $_GET['order']; } else { $requestedOrder = <your default>; }

Mind the in_array() call. Always sanitize user input.



Jason Pruim schreef:
Hi All :)

Hope you're not getting sick of my questions as of late, but I keep getting closer and closer and thank you all who have helped me in the past! "The only reason I can see this far is I am standing on the shoulders of giants" don't know who said that but I like it :)

Anyway... Onto the question...

I think I'm just going crazy as it's been a busy week for me, but I can't figure out how to do this. What I am attempting to do is, I have a webpage(Don't we all?) that calls info to be displayed from a database,

I want to be able to sort that info so my sql query looks like: "Select * from current order by '$order';" and $order is populated by a GET when they click on a link: "<A href=index.php?order='Last'>Sort by last name</A>" Now... the whole PHP page is being included in a .shtml page to actually display it and make it look purrdee :)

How do I get it to resort the info and include the new sort on the page?

I'm not sure if this has anything to do with it but:

$order = $_GET['order']; <------Line 6

[Fri Aug 10 10:42:04 2007] [error] PHP Notice: Undefined index: order in /Volumes/RAIDer/webserver/Documents/tests/legion/index.php on line 6

Any help will be greatly appreciated.. And if it solves the problem I'll name some of my kids* after you!

*Subject to approval of the Wife :)


Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to