PHP errors for (isset) variables and optimization

barsogBoose

New Member
My error logs get huge quick because I reference a ton of variables with may or may not exist. I have been going back through and starting to clean them up but wanted to see if there was a more effective (and cleaner) way of checking for php variables. Currently I use as the following:Example 1:\[code\]<?php if (isset($_SESSION['checked']) && $_SESSION['checked'] == "Y") { do something; }?>\[/code\]Example 2:(within html form)\[code\]<input type="text" name="sample_number" onKeyUp="this.value=http://stackoverflow.com/questions/3937072/this.value.replace(/[^0-9]/ig,'')" value="http://stackoverflow.com/questions/3937072/<?php echo $fields['sample_number']; ?>" />\[/code\]where sample number is displayed if it is set.is there a better way to handle scenarios like these?
 
Back
Top