Right now my pages look something like this:
if($_GET[\'something\'] == \'somevalue\')
{
$output .= \'somecode\';
// make a DB query, fetch a row
If you're searching for a code structure which will look pretty and will work - you could use the whitelist method I always use. For example - validating a $_GET variable:
$error = false;
if(!isset($_GET['var']))
{
$error = 'Please enter var\'s value';
}
elseif(empty($_GET['var']))
{
$error = 'Var shouldn\'t be empty';
}
elseif(!ctype_alnum($_GET['var']))
{
$error = 'Var should be alphanumeric';
}
//if we have no errors -> proceed to db part
if(!$error)
{
//inserting var into database table
}
So, this is it , just 2 if/elseif blocks, without nesting