On Thu, 2012-03-15 at 18:52 +0000, Stuart Dallas wrote: > On 15 Mar 2012, at 18:48, sono...@fannullone.us wrote: > > > On Mar 15, 2012, at 11:35 AM, Daniel Brown wrote: > > > >> On Thu, Mar 15, 2012 at 14:31, Stuart Dallas <stu...@3ft9.com> wrote: > >>> > >>> The @ prefix is banned from all code I go anywhere near - it's evil! > >> > >> For the most part, I agree with you, > > > > Hmm... I use it on my web pages (unless I'm testing) so that if > > something goes wrong, my customers don't see a bunch of garbage with paths > > to my PHP scripts. Is there a better way to handle this situation? > > Change your php.ini settings to log to a file and set display_errors to off. > > Error, warnings and notices are all telling you something - ignoring them is > ill-advised. "If something goes wrong" your code should be able to cope with > it without generating errors, warnings, or notices. Rule number one when I'm > coding... expect the unexpected and make sure it's appropriately handled. > > -Stuart > > -- > Stuart Dallas > 3ft9 Ltd > http://3ft9.com/ >
How about this, which I know is a horrible use of nested ternary if statements but I wouldn't take it beyond nesting 1 or 2 anyway: $first_name = (isset($_POST['first_name']))?$_POST['first_name']:( isset($_SESSION['first_name'])?$_SESSION['firstname']:null); But if this is something you're going to need for several values, I'd go with a function to do the checking for you as someone else above mentioned -- Thanks, Ash http://www.ashleysheridan.co.uk