I'm more or less a noob. I have used the below code on another webpage, but on a new site that I am working on I attempted to trim the variable and now the page won't load. Can someone show me what I did wrong or a better way to accomplish this?
<?php
# GRAB THE VARIABLES FROM THE URL
$x = $_GET['x'];
$valid = array('cat:1', 'cat:2', 'cat:3', 'cat:4', 'cat:5', 'cat:6', 'cat:7', 'cat:8', 'cat:9', 'cat:10', 'cat:11');
if(in_array($x, $valid))
$trimmed = trim($x, "cat:");
include_once $trimmed . '.inc';
else
include '1.inc';
?>
When I used this before my variables did not have a colon in them, so I did not have to trim the variable, thus the last part of the script was:
if(in_array($x, $valid))
include_once $x . '.inc';
else
include('1.inc');
?>