Re: Friday morning brain farts....

From: Date: Fri, 10 Aug 2007 14:51:24 +0000
Subject: Re: Friday morning brain farts....
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-260579@lists.php.net to get a copy of this message
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. greetz, boro 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 www.raoset.com japruim@raoset.com


« previous php.general (#260579) next »