you could do the php part like this,
PHP Code:$css = isset($_GET['css']) ? trim($_GET['css']) : '';
$thecss = array('one', 'two', 'tree', 'four'); // Just letter names
if (in_array($css, $thecss)==false) {
$css = 'one';
}
algorithm:
interface:PHP Code:$css = isset($_GET['css']) ? trim($_GET['css']) : '';
$thecss = array('one', 'two', 'tree', 'four'); // Just letter names
if (!isset($css) || empty($css)) {
$css = 'one';
}
elseif (isset($css) && array_key_exists($css, $thecss)) {
$css = $thecss[$css];
} else {
if (!empty($css) && !in_array($css, $csses)) { exit; }
}
usage:Code:<form method="get" action="./index.php"> <p> <select name="css"> <option value="one">one</option> <option value="two">two</option> <option value="tree">tree</option> <option value="four">four</option> </select> <input type="submit" value="Ok"/> </p> </form>
Code:<link rel="stylesheet" type="text/css" href="./folder/'.$css.'.css"/>
Last edited by arnage; 20-04-11 at 20:38.
<!DOCTYPE html PUBLIC "-//WAPFORUM.RS
you could do the php part like this,
PHP Code:$css = isset($_GET['css']) ? trim($_GET['css']) : '';
$thecss = array('one', 'two', 'tree', 'four'); // Just letter names
if (in_array($css, $thecss)==false) {
$css = 'one';
}
Advertise your mobile site for FREE with [Only registered and activated users can see links. Click Here To Register...]
[Only registered and activated users can see links. Click Here To Register...]
arnage (18-04-11)
Well i guess that elegant code comes with the experience. Maybe im too obsessed with checking...![]()
<!DOCTYPE html PUBLIC "-//WAPFORUM.RS
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks