Simple get selector function
Monday, October 23rd, 2006I know I haven’t posted in a while, been busy with a new job change, several startups and tons of personal life clutter. So I’ll post a quick PHP snippit I wrote not to long ago. The history on this is that I wanted a quick and dirty way to grab a selector from a url string if it was as post or get:
[code lang="php"]
function getSelector ( $getSelector ) {
if( !empty($_POST[$getSelector]) ) {
$results = strip_tags( $_POST[ $getSelector ] );
}
if( !empty($_GET[$getSelector]) ) {
$results = strip_tags( $_GET[ $getSelector ] );
}
if ( !isSet($results) ) {
$results = “”;
}
return $results;
}
[/code]
Let me know how it works for you!