Try this:
PHP:<? php if(isset($_GET['kw'])){ echo ucwords($_GET[’kw’]); } else{ echo ucwords(”Your Original Info Here”); } ?>
Your echo statements do not look right to me, but not sure.
<?php
$_GET['kw'] = trim( urldecode( $_GET['kw'] ) );
if( !empty( $_GET['kw'] ) ) {
echo ucwords( $_GET['kw'] );
} else echo 'no keyword given';
?>
<?php
$_GET['kw'] = trim( urldecode( $_GET['kw'] ) );
$keyword = ( !empty( $_GET['kw'] ) ) ? ucwords( $_GET['kw'] ) : 'no keyword given';
?>
never use isset() - always use empty() or if it should be a number in the var use is_numeric().
never use isset() - always use empty() or if it should be a number in the var use is_numeric().
so its
another way to set a var would be:PHP:<?php $_GET['kw'] = trim( urldecode( $_GET['kw'] ) ); if( !empty( $_GET['kw'] ) ) { echo ucwords( $_GET['kw'] ); } else echo 'no keyword given'; ?>
PHP:<?php $_GET['kw'] = trim( urldecode( $_GET['kw'] ) ); $keyword = ( !empty( $_GET['kw'] ) ) ? ucwords( $_GET['kw'] ) : 'no keyword given'; ?>
How come no isset()?
Hey Tobsn, I've heard you are an excellent php programmer, do you have any resources to suggest as far as best practices for php?
is set returns true even if there is nothing in it because it tests if the variable IS SET not if anything is in it
try it
domain.com/bla.php?var=
isset( $_GET['var'] ) should return true, even if there is nothing in it - because the var "is set"
got it?![]()