Re: below, i put in global $test;
> Thanks for the advice... I am new to PHP, but have done a lot of C in the > past so some things are familiar. > > Anyway, I tried your suggestion but no joy... color does not show, as if i > had written bgcolor="". > > Any ideas??? > > Cheers, > Adam. > > ----- Original Message ----- > From: "Marco Tabini" <[EMAIL PROTECTED]> > To: "Adam" <[EMAIL PROTECTED]> > Sent: Friday, November 15, 2002 2:47 PM > Subject: Re: [PHP] #color problems > > > > Since you're not substituting anything in your string, you can use > > single quotes and make it a bit more readable: > > > > $test='#FFFFFF'; > > > > echo '<td width="33%" bgcolor="' . $test . '">'; > > > > > > is $test defined in the same context as your echo statement (e.g. is the > > echo in a function and $test outside of it)? In that case, you need to > > add $test to your function's context by means of global $test; > > > > Marco > > -- > > ------------ > > php|architect - The magazine for PHP Professionals > > The monthly worldwide magazine dedicated to PHP programmers > > > > Come visit us at http://www.phparch.com! > > > > > > On Fri, 2002-11-15 at 10:13, Adam wrote: > > > Below is a snip of my script. Can't get it to use $test as a color > > > variable!! > > > Can anyone help?? I have tried everything i can think of (bar just using > a > > > color value instead of variable). > > > > > > The context is :: for formatting an XML doc. > > > > > > $test='#FFFFFF'; > > > > > > echo "<td width=\"33%\" bgcolor=\"".$test."\">"; > > > > > > Any help much appreciated, > > > Adam. > > > > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php